-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Doc-43] add stories to atoms #810
base: dev
Are you sure you want to change the base?
Changes from all commits
6f44d22
5c72a29
125fe8f
2154695
eae2cb6
bc47e42
7a568cc
7f5d659
6346e56
c2bfbd9
a5b6720
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import React, { FC } from 'react'; | ||
import CircularProgress from '@material-ui/core/CircularProgress'; | ||
|
||
interface IProps { | ||
} | ||
export interface IProps {} | ||
|
||
const Loader: FC<IProps> = () => <CircularProgress /> | ||
export default Loader; | ||
const Loader: FC<IProps> = () => <CircularProgress />; | ||
export default Loader; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import { AnyWayButton } from '../AnyWayButton'; | ||
|
||
export default { | ||
title: 'Components/atoms/AnyWayButton', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AnyWayButton is about to be refactored / remove, no need a story for this one |
||
component: AnyWayButton, | ||
} as Meta; | ||
|
||
const Template: Story<ComponentProps<typeof AnyWayButton>> = (args) => <AnyWayButton {...args} />; | ||
|
||
export const AnyWayButtonS = Template.bind({}); | ||
AnyWayButtonS.args = { | ||
onClick: () => console.log('You clicked it!'), | ||
children: 'Anyway Button', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import AppBar from '../AppBar'; | ||
|
||
export default { | ||
title: 'Components/atoms/AppBar', | ||
component: AppBar, | ||
} as Meta; | ||
|
||
const Template: Story<ComponentProps<typeof AppBar>> = (args) => <AppBar {...args} />; | ||
|
||
export const AppBarS = Template.bind({}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following can be applied for all stories
|
||
AppBarS.args = { | ||
children: <div>This is the AppBar</div>, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ComponentProps, ReactNode } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import Button, { IProps } from 'components/atoms/Button'; | ||
|
||
export default { | ||
title: 'Components/atoms/Button', | ||
component: Button, | ||
argTypes: { | ||
variant: { | ||
options: ['outlined', 'standard', 'icon', 'text'], | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
} as unknown as Meta; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why |
||
|
||
const Template: Story = ({ children, ...args }) => { | ||
if (args.variant === 'standard') { | ||
return <Button.Standard {...args}>{children}</Button.Standard>; | ||
} else if (args.variant === 'outlined') { | ||
return <Button.Outlined {...args}>{children}</Button.Outlined>; | ||
} else if (args.variant === 'icon') { | ||
return <Button.Icon {...args}>{children}</Button.Icon>; | ||
} else if (args.variant === 'text') { | ||
return <Button.Text {...args}>{children}</Button.Text>; | ||
} else { | ||
return <div>This component must have a type prop</div>; | ||
} | ||
}; | ||
|
||
export const Buttons = Template.bind({}); | ||
Buttons.args = { | ||
children: 'Button', | ||
variant: 'standard', | ||
isSubmit: false, | ||
onClick: () => 'text', | ||
}; | ||
|
||
// export const ButtonOutlinedS = Template.bind({}); | ||
// ButtonOutlinedS.args = { | ||
// type: 'outlined', | ||
// children: 'Button', | ||
// }; | ||
|
||
// export const ButtonIconS = Template.bind({}); | ||
// ButtonIconS.args = { | ||
// type: 'icon', | ||
// children: 'Button', | ||
// }; | ||
Comment on lines
+38
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove if not needed |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import Dialog from '../Dialog'; | ||
|
||
export default { | ||
title: 'Components/atoms/Dialog', | ||
component: Dialog, | ||
} as Meta; | ||
|
||
const Template: Story<ComponentProps<typeof Dialog>> = (args) => <Dialog {...args} />; | ||
|
||
export const DialogS = Template.bind({}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is not possible to display the dialog from the main content area. can you include a button which will open it? |
||
DialogS.args = { | ||
children: 'DialogS', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import Grid from '../Grid'; | ||
|
||
export default { | ||
title: 'Components/atoms/Grid', | ||
component: Grid, | ||
} as unknown as Meta; | ||
|
||
const Template: Story<ComponentProps<typeof Grid.Container>> = (args) => <Grid.Container {...args} />; | ||
|
||
export const GridS = Template.bind({}); | ||
GridS.args = { | ||
children: 'GridS', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import Link, { IProps } from '../Link'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
export default { | ||
title: 'Components/atoms/Link', | ||
component: Link, | ||
} as Meta; | ||
|
||
const Template: Story<IProps> = (args) => { | ||
return ( | ||
<Router> | ||
<Link {...args} /> | ||
</Router> | ||
); | ||
}; | ||
|
||
export const LinkS = Template.bind({}); | ||
LinkS.args = { | ||
children: 'Example link', | ||
to: '#', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React, { ComponentProps, FC } from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
import Loader, { IProps } from '../Loader'; | ||
|
||
export default { | ||
title: 'Components/atoms/Loader', | ||
component: Loader, | ||
} as Meta; | ||
|
||
export const LoaderS: FC<IProps> = (args) => <Loader {...args} />; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,34 @@ | ||||||
import React, { ComponentProps, FC } from 'react'; | ||||||
import { Story, Meta } from '@storybook/react'; | ||||||
import Menu, { IProps } from '../Menu'; | ||||||
|
||||||
export default { | ||||||
title: 'Components/atoms/Menu', | ||||||
component: Menu, | ||||||
argTypes: { | ||||||
anchorEl: { | ||||||
control: { type: 'boolean' }, | ||||||
}, | ||||||
}, | ||||||
} as Meta; | ||||||
|
||||||
const Item: FC<ItemProps> = ({ number }) => { | ||||||
return <div>Item no^{number}</div>; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}; | ||||||
const NUM_ITEMS = Array.from(Array(10).keys()); | ||||||
const Items = NUM_ITEMS.map((itemNum) => <Item number={itemNum} />); | ||||||
|
||||||
const handleClose = () => console.log('Menu Close Function'); | ||||||
|
||||||
const Template: Story<ComponentProps<typeof Menu>> = (args) => <Menu {...args} />; | ||||||
|
||||||
export const MenuS = Template.bind({}); | ||||||
MenuS.args = { | ||||||
items: Items, | ||||||
handleClose, | ||||||
anchorEl: document.body, | ||||||
}; | ||||||
|
||||||
interface ItemProps { | ||||||
number: number; | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
icon button does not need
isSubmit
(it is never used for submit)