Skip to content

Commit 235043c

Browse files
committed
chore: storybook cleanup
1 parent 0f8ad41 commit 235043c

File tree

6 files changed

+142
-142
lines changed

6 files changed

+142
-142
lines changed

.storybook/addons/yaml-addon/register.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import {AddonPanel} from '@storybook/components';
33
import {addons, types, useGlobals, useArgs} from '@storybook/manager-api';
4-
import yaml from 'js-yaml';
4+
import yaml, {JSON_SCHEMA} from 'js-yaml';
55
import {ClipboardButton, ThemeProvider} from '@gravity-ui/uikit';
66

77
import './AddonYaml.css';
@@ -20,6 +20,7 @@ const YamlPanel = () => {
2020
lineWidth: -1,
2121
forceQuotes: true,
2222
skipInvalid: true,
23+
noRefs: true,
2324
}),
2425
[params],
2526
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@import '../../../../styles/variables.scss';
2+
3+
.pc-Grid {
4+
section {
5+
border-radius: $indentXXS;
6+
}
7+
8+
.col {
9+
display: flex;
10+
align-items: center;
11+
}
12+
}

src/components/Button/__stories__/Button.stories.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import * as React from 'react';
2-
31
import {Meta, StoryFn} from '@storybook/react';
42

5-
import {Col, Row} from '../../../grid';
3+
import {Col, Grid, Row} from '../../../grid';
64
import Button, {ButtonProps} from '../Button';
75

86
import data from './data.json';
97

8+
import './Button.stories.scss';
9+
1010
export default {
1111
component: Button,
1212
title: 'Components/Links and buttons/Button',
@@ -31,7 +31,7 @@ const SizesTemplate: StoryFn<ButtonProps> = (args) => (
3131
</Row>
3232
);
3333
const ThemesSizesTemplate: StoryFn<ButtonProps> = (args) => (
34-
<React.Fragment>
34+
<Grid>
3535
<Row>
3636
<Col />
3737
<Col>s</Col>
@@ -55,11 +55,11 @@ const ThemesSizesTemplate: StoryFn<ButtonProps> = (args) => (
5555
<SizesTemplate {...args} theme="flat-danger" />
5656
<SizesTemplate {...args} theme="flat-secondary" />
5757
<SizesTemplate {...args} theme="normal-contrast" />
58-
<section style={{color: '#3a74ff'}}>
58+
<section style={{color: '#fff', background: '#3a74ff'}}>
5959
<SizesTemplate {...args} theme="outlined-contrast" />
6060
<SizesTemplate {...args} theme="flat-contrast" />
6161
</section>
62-
</React.Fragment>
62+
</Grid>
6363
);
6464

6565
const WidthTemplate: StoryFn<ButtonProps> = (args) => (

src/components/Title/__stories__/Title.stories.tsx

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,50 +18,19 @@ const SizesTemplate: StoryFn<TitleProps & ClassNameProps> = (args) => {
1818

1919
return (
2020
<div>
21-
<div style={{paddingBottom: '64px'}}>
22-
<Title
23-
{...args}
24-
title={
25-
{
26-
...data.sizes.l,
27-
...titleItemObjectProps,
28-
} as TitleItemProps
29-
}
30-
/>
31-
</div>
32-
<div style={{paddingBottom: '64px'}}>
33-
<Title
34-
{...args}
35-
title={
36-
{
37-
...data.sizes.m,
38-
...titleItemObjectProps,
39-
} as TitleItemProps
40-
}
41-
/>
42-
</div>
43-
<div style={{paddingBottom: '64px'}}>
44-
<Title
45-
{...args}
46-
title={
47-
{
48-
...data.sizes.s,
49-
...titleItemObjectProps,
50-
} as TitleItemProps
51-
}
52-
/>
53-
</div>
54-
<div style={{paddingBottom: '64px'}}>
55-
<Title
56-
{...args}
57-
title={
58-
{
59-
...data.sizes.xs,
60-
...titleItemObjectProps,
61-
} as TitleItemProps
62-
}
63-
/>
64-
</div>
21+
{Object.entries(data.sizes).map(([size, props]) => (
22+
<div key={size} style={{paddingBottom: '64px'}}>
23+
<Title
24+
{...args}
25+
title={
26+
{
27+
...props,
28+
...titleItemObjectProps,
29+
} as TitleItemProps
30+
}
31+
/>
32+
</div>
33+
))}
6534
</div>
6635
);
6736
};

src/components/Title/__stories__/data.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@
2525
}
2626
},
2727
"sizes": {
28-
"xs": {
29-
"text": "Size XS",
30-
"textSize": "xs"
31-
},
32-
"s": {
33-
"text": "Size S",
34-
"textSize": "s"
28+
"l": {
29+
"text": "Size L",
30+
"textSize": "l"
3531
},
3632
"m": {
3733
"text": "Size M",
3834
"textSize": "m"
3935
},
40-
"l": {
41-
"text": "Size L",
42-
"textSize": "l"
36+
"sm": {
37+
"text": "Size SM",
38+
"textSize": "sm"
39+
},
40+
"s": {
41+
"text": "Size S",
42+
"textSize": "s"
43+
},
44+
"xs": {
45+
"text": "Size XS",
46+
"textSize": "xs"
4347
}
4448
}
4549
}

0 commit comments

Comments
 (0)