|
1 |
| -import { css } from '@emotion/react'; |
2 | 1 | import { space } from '@guardian/source/foundations';
|
3 |
| -import { CardCommentCount } from './CardCommentCount.importable'; |
4 |
| -import { Island } from './Island'; |
| 2 | +import type { Meta, StoryObj } from '@storybook/react'; |
| 3 | +import { CardCommentCount as CardCommentCountComponent } from './CardCommentCount.importable'; |
5 | 4 |
|
6 |
| -export default { |
7 |
| - component: CardCommentCount, |
8 |
| - title: 'Components/CardCommentCount', |
9 |
| -}; |
| 5 | +const meta = { |
| 6 | + component: CardCommentCountComponent, |
| 7 | + title: 'Components/Card Comment Count', |
| 8 | +} satisfies Meta<typeof CardCommentCountComponent>; |
10 | 9 |
|
11 |
| -const Wrapper = ({ children }: { children: React.ReactNode }) => { |
12 |
| - return ( |
13 |
| - <div |
14 |
| - css={css` |
15 |
| - padding: ${space[6]}px; |
16 |
| - `} |
17 |
| - > |
18 |
| - {children} |
19 |
| - </div> |
20 |
| - ); |
21 |
| -}; |
| 10 | +export default meta; |
22 | 11 |
|
23 |
| -export const CommentCountStory = () => { |
24 |
| - return ( |
25 |
| - <Wrapper> |
26 |
| - <Island priority="critical"> |
27 |
| - <CardCommentCount |
28 |
| - discussionApiUrl="https://discussion.theguardian.com/discussion-api" |
29 |
| - discussionId="/p/zemg8" |
30 |
| - /> |
31 |
| - </Island> |
32 |
| - </Wrapper> |
33 |
| - ); |
34 |
| -}; |
35 |
| -CommentCountStory.storyName = 'default'; |
| 12 | +type Story = StoryObj<typeof meta>; |
36 | 13 |
|
37 |
| -export const GalleryStory = () => { |
38 |
| - return ( |
39 |
| - <Wrapper> |
40 |
| - <Island priority="critical"> |
41 |
| - <CardCommentCount |
42 |
| - discussionApiUrl="https://discussion.theguardian.com/discussion-api" |
43 |
| - discussionId="/p/zemg8" |
44 |
| - /> |
45 |
| - </Island> |
46 |
| - </Wrapper> |
47 |
| - ); |
48 |
| -}; |
49 |
| -GalleryStory.storyName = 'Gallery'; |
| 14 | +export const CardCommentCount = { |
| 15 | + args: { |
| 16 | + discussionApiUrl: 'https://discussion.theguardian.com/discussion-api', |
| 17 | + discussionId: '/p/zemg8', |
| 18 | + }, |
| 19 | + decorators: [ |
| 20 | + (Story) => ( |
| 21 | + <div css={{ padding: space[6] }}> |
| 22 | + <Story /> |
| 23 | + </div> |
| 24 | + ), |
| 25 | + ], |
| 26 | +} satisfies Story; |
0 commit comments