-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: storybook alias, add storybook cases
- Loading branch information
Showing
12 changed files
with
126 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 61 additions & 2 deletions
63
src/entities/Notification/ui/NotificationList/NotificationList.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,76 @@ | ||
import React from 'react'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
import withMock from 'storybook-addon-mock'; | ||
import { NotificationList } from './NotificationList'; | ||
import { StoreDecorator } from '@/shared/config/storybook/StoreDecorator/StoreDecorator'; | ||
|
||
export default { | ||
title: 'shared/NotificationList', | ||
title: 'entities/Notification/NotificationList', | ||
component: NotificationList, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
decorators: [withMock], | ||
} as ComponentMeta<typeof NotificationList>; | ||
|
||
const Template: ComponentStory<typeof NotificationList> = (args) => <NotificationList {...args} />; | ||
|
||
export const Normal = Template.bind({}); | ||
Normal.args = {}; | ||
|
||
Normal.decorators = [ | ||
StoreDecorator({ }), | ||
]; | ||
|
||
Normal.parameters = { | ||
mockData: [ | ||
{ | ||
url: `${__API__}/notifications`, | ||
method: 'GET', | ||
status: 200, | ||
response: [ | ||
{ | ||
id: '1', | ||
title: 'title', | ||
description: 'description', | ||
}, | ||
{ | ||
id: '2', | ||
title: 'title', | ||
description: 'description', | ||
}, | ||
{ | ||
id: '3', | ||
title: 'title', | ||
description: 'description', | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export const WithLink = Template.bind({}); | ||
WithLink.args = {}; | ||
|
||
WithLink.decorators = [ | ||
StoreDecorator({ }), | ||
]; | ||
|
||
WithLink.parameters = { | ||
mockData: [ | ||
{ | ||
url: `${__API__}/notifications`, | ||
method: 'GET', | ||
status: 200, | ||
response: [ | ||
{ | ||
id: '1', | ||
title: 'title', | ||
description: 'description', | ||
href: 'link', | ||
}, | ||
], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 50 additions & 2 deletions
52
src/features/articleRating/ui/ArticleRating/ArticleRating.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,65 @@ | ||
import React from 'react'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
|
||
import withMock from 'storybook-addon-mock'; | ||
import ArticleRating from './ArticleRating'; | ||
import { StoreDecorator } from '@/shared/config/storybook/StoreDecorator/StoreDecorator'; | ||
|
||
export default { | ||
title: 'shared/ArticleRating', | ||
title: 'features/ArticleRating', | ||
component: ArticleRating, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
decorators: [withMock], | ||
} as ComponentMeta<typeof ArticleRating>; | ||
|
||
const Template: ComponentStory<typeof ArticleRating> = (args) => <ArticleRating {...args} />; | ||
|
||
export const Normal = Template.bind({}); | ||
Normal.args = {}; | ||
Normal.args = { | ||
articleId: '1', | ||
}; | ||
|
||
Normal.decorators = [ | ||
StoreDecorator({ | ||
user: { | ||
authData: { id: '1' }, | ||
}, | ||
}), | ||
]; | ||
Normal.parameters = { | ||
mockData: [ | ||
{ | ||
url: `${__API__}/article-ratings?userId=1&articleId=1`, | ||
method: 'GET', | ||
status: 200, | ||
response: [ | ||
{ rate: '4', id: '1' }, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export const WithoutRating = Template.bind({}); | ||
WithoutRating.args = { | ||
articleId: '1', | ||
}; | ||
|
||
WithoutRating.decorators = [ | ||
StoreDecorator({ | ||
user: { | ||
authData: { id: '1' }, | ||
}, | ||
}), | ||
]; | ||
WithoutRating.parameters = { | ||
mockData: [ | ||
{ | ||
url: `${__API__}/article-ratings?userId=1&articleId=1`, | ||
method: 'GET', | ||
status: 200, | ||
response: [], | ||
}, | ||
], | ||
}; |
3 changes: 1 addition & 2 deletions
3
src/features/notificationButton/ui/NotificationButton/NotificationButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters