Skip to content

chore: storybook cleanup #1170

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

Merged
merged 3 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .storybook/addons/yaml-addon/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const YamlPanel = () => {
lineWidth: -1,
forceQuotes: true,
skipInvalid: true,
noRefs: true,
}),
[params],
);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/components/Button/__stories__/Button.stories.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@import '../../../../styles/variables.scss';

.pc-Grid {
section {
border-radius: $indentXXS;
}

.col {
display: flex;
align-items: center;
}
}
12 changes: 6 additions & 6 deletions src/components/Button/__stories__/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';

import {Meta, StoryFn} from '@storybook/react';

import {Col, Row} from '../../../grid';
import {Col, Grid, Row} from '../../../grid';
import Button, {ButtonProps} from '../Button';

import data from './data.json';

import './Button.stories.scss';

export default {
component: Button,
title: 'Components/Links and buttons/Button',
Expand All @@ -31,7 +31,7 @@ const SizesTemplate: StoryFn<ButtonProps> = (args) => (
</Row>
);
const ThemesSizesTemplate: StoryFn<ButtonProps> = (args) => (
<React.Fragment>
<Grid>
<Row>
<Col />
<Col>s</Col>
Expand All @@ -55,11 +55,11 @@ const ThemesSizesTemplate: StoryFn<ButtonProps> = (args) => (
<SizesTemplate {...args} theme="flat-danger" />
<SizesTemplate {...args} theme="flat-secondary" />
<SizesTemplate {...args} theme="normal-contrast" />
<section style={{color: '#3a74ff'}}>
<section style={{color: '#fff', background: '#3a74ff'}}>
<SizesTemplate {...args} theme="outlined-contrast" />
<SizesTemplate {...args} theme="flat-contrast" />
</section>
</React.Fragment>
</Grid>
);

const WidthTemplate: StoryFn<ButtonProps> = (args) => (
Expand Down
57 changes: 13 additions & 44 deletions src/components/Title/__stories__/Title.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,19 @@ const SizesTemplate: StoryFn<TitleProps & ClassNameProps> = (args) => {

return (
<div>
<div style={{paddingBottom: '64px'}}>
<Title
{...args}
title={
{
...data.sizes.l,
...titleItemObjectProps,
} as TitleItemProps
}
/>
</div>
<div style={{paddingBottom: '64px'}}>
<Title
{...args}
title={
{
...data.sizes.m,
...titleItemObjectProps,
} as TitleItemProps
}
/>
</div>
<div style={{paddingBottom: '64px'}}>
<Title
{...args}
title={
{
...data.sizes.s,
...titleItemObjectProps,
} as TitleItemProps
}
/>
</div>
<div style={{paddingBottom: '64px'}}>
<Title
{...args}
title={
{
...data.sizes.xs,
...titleItemObjectProps,
} as TitleItemProps
}
/>
</div>
{Object.entries(data.sizes).map(([size, props]) => (
<div key={size} style={{paddingBottom: '64px'}}>
<Title
{...args}
title={
{
...props,
...titleItemObjectProps,
} as TitleItemProps
}
/>
</div>
))}
</div>
);
};
Expand Down
24 changes: 14 additions & 10 deletions src/components/Title/__stories__/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,25 @@
}
},
"sizes": {
"xs": {
"text": "Size XS",
"textSize": "xs"
},
"s": {
"text": "Size S",
"textSize": "s"
"l": {
"text": "Size L",
"textSize": "l"
},
"m": {
"text": "Size M",
"textSize": "m"
},
"l": {
"text": "Size L",
"textSize": "l"
"sm": {
"text": "Size SM",
"textSize": "sm"
},
"s": {
"text": "Size S",
"textSize": "s"
},
"xs": {
"text": "Size XS",
"textSize": "xs"
}
}
}