Skip to content

Commit 880aed5

Browse files
chore(FullWidthBackground): update story (#1320)
* chore(FullWidthBackground): update story * chore: delete argTypes from story --------- Co-authored-by: Anastasiia Kurochkina
1 parent a227d77 commit 880aed5

File tree

8 files changed

+84
-18
lines changed

8 files changed

+84
-18
lines changed
Loading
Loading
Loading
Loading

src/components/FullWidthBackground/__stories__/FullWidthBackground.stories.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,40 @@ import FullWidthBackground, {FullWidthBackgroundProps} from '../FullWidthBackgro
55
import data from './data.json';
66

77
export default {
8-
component: FullWidthBackground,
98
title: 'Components/FullWidthBackground',
9+
component: FullWidthBackground,
1010
} as Meta;
1111

12-
const DefaultTemplate: StoryFn<FullWidthBackgroundProps> = (args) => (
13-
<div style={{height: '100px'}}>
14-
<FullWidthBackground {...args}>Children</FullWidthBackground>
15-
</div>
16-
);
12+
const DefaultTemplate: StoryFn<FullWidthBackgroundProps> = (args) => {
13+
return (
14+
<div
15+
style={{
16+
height: '100px',
17+
}}
18+
key={args.theme}
19+
>
20+
<FullWidthBackground {...args}>
21+
<div
22+
style={{
23+
padding: '20px',
24+
margin: '20px',
25+
}}
26+
>
27+
Children
28+
</div>
29+
</FullWidthBackground>
30+
</div>
31+
);
32+
};
1733

1834
export const Default = DefaultTemplate.bind({});
1935
export const Rounded = DefaultTemplate.bind({});
2036

21-
Default.args = data.default.content as FullWidthBackgroundProps;
22-
Rounded.args = data.rounded.content as FullWidthBackgroundProps;
37+
Default.args = data.default as FullWidthBackgroundProps;
38+
39+
Rounded.args = data.rounded as FullWidthBackgroundProps;
40+
Rounded.parameters = {
41+
controls: {
42+
include: Object.keys(data.rounded),
43+
},
44+
};
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
{
22
"default": {
3-
"content": {
4-
"style": {
5-
"backgroundColor": "#ffbe5c"
6-
},
7-
"theme": "default"
3+
"theme": "default",
4+
"style": {
5+
"backgroundColor": "#ffbe5c"
86
}
97
},
108
"rounded": {
11-
"content": {
12-
"style": {
13-
"backgroundColor": "#ffbe5c"
14-
},
15-
"theme": "rounded"
9+
"theme": "rounded",
10+
"style": {
11+
"backgroundColor": "#ffbe5c"
1612
}
1713
}
1814
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {test} from '../../../../playwright/core/index';
2+
3+
import {Default, Rounded} from './helpers';
4+
5+
test.describe('FullWidthBackground', () => {
6+
test('default', async ({mount, expectScreenshot, defaultDelay, page}) => {
7+
await page.setViewportSize({width: 850, height: 150});
8+
await mount(<Default />);
9+
await defaultDelay();
10+
await expectScreenshot({skipTheme: 'dark'});
11+
});
12+
13+
test('rounded', async ({mount, expectScreenshot, defaultDelay, page}) => {
14+
await page.setViewportSize({width: 850, height: 150});
15+
await mount(<Rounded />);
16+
await defaultDelay();
17+
await expectScreenshot({skipTheme: 'dark'});
18+
});
19+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {composeStories} from '@storybook/react';
2+
3+
import * as FullWidthBackgroundStories from '../__stories__/FullWidthBackground.stories';
4+
5+
const stories = composeStories(FullWidthBackgroundStories);
6+
7+
export const Default = () => (
8+
<div
9+
style={{
10+
width: '800px',
11+
height: '100px',
12+
position: 'relative',
13+
}}
14+
>
15+
<stories.Default />
16+
</div>
17+
);
18+
19+
export const Rounded = () => (
20+
<div
21+
style={{
22+
width: '800px',
23+
height: '100px',
24+
position: 'relative',
25+
}}
26+
>
27+
<stories.Rounded />
28+
</div>
29+
);

0 commit comments

Comments
 (0)