|
@@ -1,10 +1,8 @@
|
|
|
import React from 'react';
|
|
|
-import {boolean, color} from '@storybook/addon-knobs';
|
|
|
-import {withInfo} from '@storybook/addon-info';
|
|
|
|
|
|
+import ActivityItem from 'app/components/activity/item';
|
|
|
import ActivityAvatar from 'app/components/activity/item/avatar';
|
|
|
import ActivityBubble from 'app/components/activity/item/bubble';
|
|
|
-import ActivityItem from 'app/components/activity/item';
|
|
|
|
|
|
const user = {
|
|
|
username: 'billy@sentry.io',
|
|
@@ -20,25 +18,32 @@ export default {
|
|
|
title: 'Core/_Activity/Item',
|
|
|
};
|
|
|
|
|
|
-export const DefaultActivityItem = withInfo(
|
|
|
- 'An Activity Item is composed of: an author, header, body, and additionally timestamp and a status.'
|
|
|
-)(() => (
|
|
|
+export const DefaultActivityItem = ({hideDate}) => (
|
|
|
<ActivityItem
|
|
|
author={{type: 'user', user}}
|
|
|
item={{id: '123'}}
|
|
|
date={new Date()}
|
|
|
header={<div>{user.email}</div>}
|
|
|
- hideDate={boolean('Hide Date', false)}
|
|
|
+ hideDate={hideDate}
|
|
|
>
|
|
|
Activity Item
|
|
|
</ActivityItem>
|
|
|
-));
|
|
|
+);
|
|
|
|
|
|
-DefaultActivityItem.story = {
|
|
|
- name: 'default ActivityItem',
|
|
|
+DefaultActivityItem.storyName = 'default ActivityItem';
|
|
|
+DefaultActivityItem.args = {
|
|
|
+ hideDate: false,
|
|
|
+};
|
|
|
+DefaultActivityItem.parameters = {
|
|
|
+ docs: {
|
|
|
+ description: {
|
|
|
+ story:
|
|
|
+ 'An Activity Item is composed of: an author, header, body, and additionally timestamp and a status.',
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
-export const WithCustomHeader = withInfo('Activity Item with a custom header')(() => (
|
|
|
+export const WithCustomHeader = ({hideDate}) => (
|
|
|
<ActivityItem
|
|
|
author={{type: 'user', user}}
|
|
|
item={{id: '123'}}
|
|
@@ -46,64 +51,101 @@ export const WithCustomHeader = withInfo('Activity Item with a custom header')((
|
|
|
header={() => (
|
|
|
<div style={{backgroundColor: '#ccc'}}>Custom header (no timestamp)</div>
|
|
|
)}
|
|
|
+ hideDate={hideDate}
|
|
|
>
|
|
|
Activity Item
|
|
|
</ActivityItem>
|
|
|
-));
|
|
|
+);
|
|
|
|
|
|
-WithCustomHeader.story = {
|
|
|
- name: 'with custom Header',
|
|
|
+WithCustomHeader.storyName = 'with custom Header';
|
|
|
+WithCustomHeader.args = {
|
|
|
+ hideDate: false,
|
|
|
+};
|
|
|
+WithCustomHeader.parameters = {
|
|
|
+ docs: {
|
|
|
+ description: {
|
|
|
+ story: 'Activity Item with a custom header',
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
-export const WithFooter = withInfo('Activity Item with a footer')(() => (
|
|
|
+export const WithFooter = ({hideDate}) => (
|
|
|
<ActivityItem
|
|
|
author={{type: 'user', user}}
|
|
|
item={{id: '123'}}
|
|
|
date={new Date()}
|
|
|
- hideDate={boolean('Hide Date', false)}
|
|
|
header={<div>{user.email}</div>}
|
|
|
footer={<div>Footer</div>}
|
|
|
+ hideDate={hideDate}
|
|
|
>
|
|
|
Activity Item
|
|
|
</ActivityItem>
|
|
|
-));
|
|
|
+);
|
|
|
|
|
|
-WithFooter.story = {
|
|
|
- name: 'with footer',
|
|
|
+WithFooter.storyName = 'with footer';
|
|
|
+WithFooter.args = {
|
|
|
+ hideDate: false,
|
|
|
+};
|
|
|
+WithFooter.parameters = {
|
|
|
+ docs: {
|
|
|
+ description: {
|
|
|
+ story: 'Activity Item with a footer',
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
-export const SystemActivity = withInfo('An ActivityItem generated by Sentry')(() => (
|
|
|
+export const SystemActivity = ({hideDate}) => (
|
|
|
<ActivityItem
|
|
|
author={{type: 'system'}}
|
|
|
item={{id: '123'}}
|
|
|
date={new Date()}
|
|
|
header={<div>Sentry detected something</div>}
|
|
|
- hideDate={boolean('Hide Date', false)}
|
|
|
+ hideDate={hideDate}
|
|
|
>
|
|
|
Sentry did something
|
|
|
</ActivityItem>
|
|
|
-));
|
|
|
+);
|
|
|
|
|
|
-SystemActivity.story = {
|
|
|
- name: 'system activity',
|
|
|
+SystemActivity.storyName = 'system activity';
|
|
|
+SystemActivity.args = {
|
|
|
+ hideDate: false,
|
|
|
+};
|
|
|
+SystemActivity.parameters = {
|
|
|
+ docs: {
|
|
|
+ description: {
|
|
|
+ story: 'An ActivityItem generated by Sentry',
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
-export const Bubble = withInfo(
|
|
|
- 'Activity bubble with arrow at the top-left. This should probably not be used directly unless creating a new component.'
|
|
|
-)(() => (
|
|
|
- <ActivityBubble
|
|
|
- backgroundColor={color('Background', '#fff')}
|
|
|
- borderColor={color('Border', 'red')}
|
|
|
- >
|
|
|
+export const Bubble = ({...args}) => (
|
|
|
+ <ActivityBubble {...args}>
|
|
|
<div>Activity Bubble</div>
|
|
|
<div>Activity Bubble</div>
|
|
|
<div>Activity Bubble</div>
|
|
|
<div>Activity Bubble</div>
|
|
|
<div>Activity Bubble</div>
|
|
|
</ActivityBubble>
|
|
|
-));
|
|
|
+);
|
|
|
+Bubble.component = ActivityBubble;
|
|
|
+Bubble.args = {
|
|
|
+ backgroundColor: '#fff',
|
|
|
+ borderColor: 'red',
|
|
|
+};
|
|
|
+Bubble.argTypes = {
|
|
|
+ backgroundColor: {control: 'color'},
|
|
|
+ borderColor: {control: 'color'},
|
|
|
+};
|
|
|
+Bubble.parameters = {
|
|
|
+ docs: {
|
|
|
+ description: {
|
|
|
+ story:
|
|
|
+ 'Activity bubble with arrow at the top-left. This should probably not be used directly unless creating a new component.',
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
|
|
|
-export const Avatar = withInfo('Avatar based on the author type.')(() => (
|
|
|
+export const Avatar = () => (
|
|
|
<div>
|
|
|
<h3>User</h3>
|
|
|
<ActivityAvatar type="user" user={user} size={48} />
|
|
@@ -111,4 +153,11 @@ export const Avatar = withInfo('Avatar based on the author type.')(() => (
|
|
|
<h3>System</h3>
|
|
|
<ActivityAvatar type="system" size={48} />
|
|
|
</div>
|
|
|
-));
|
|
|
+);
|
|
|
+Avatar.parameters = {
|
|
|
+ docs: {
|
|
|
+ description: {
|
|
|
+ story: 'Avatar based on the author type.',
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|