Skip to content

Commit 203ca7b

Browse files
authored
chore(Share): update storybook (#1322)
1 parent 659df2d commit 203ca7b

File tree

7 files changed

+30
-19
lines changed

7 files changed

+30
-19
lines changed

src/blocks/Share/Share.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ const Share = ({items, title}: ShareBlockProps) => {
6969
className={b('item', {type: type.toLowerCase()})}
7070
onClick={handleButtonClick}
7171
title={urlTitle}
72-
extraProps={{
73-
'aria-label': buttonLabel,
74-
}}
72+
aria-label={buttonLabel}
7573
>
7674
{icon && <Icon data={icon} size={24} className={b('icon', {type})} />}
7775
</Button>
-976 Bytes
Loading
-2.13 KB
Loading
-950 Bytes
Loading
-2.28 KB
Loading

src/blocks/Share/__stories__/Share.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import * as ShareStories from './Share.stories.tsx';
88
<StoryTemplate>
99
## Parameters
1010

11-
`type: share-block`;
12-
13-
`title?: string` — Title
14-
15-
`items?: []` - Share icons
11+
`type: share-block`
1612

13+
`items: PCShareSocialNetwork[]` - Share icons
14+
- `vk`
1715
- `telegram`
18-
- `facebook`
1916
- `twitter`
20-
- `vk`
21-
</StoryTemplate>
17+
- `facebook`
18+
- `linkedin`
2219

20+
`title?: string` — Title
21+
</StoryTemplate>
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
1-
import {Lang as UIKitLang, configure as uikitConfigure} from '@gravity-ui/uikit';
21
import {Meta, StoryFn} from '@storybook/react';
32

4-
import {PageConstructor} from '../../../containers/PageConstructor';
5-
import {ShareBLockModel, ShareBlockProps} from '../../../models';
3+
import {blockTransform} from '../../../../.storybook/utils';
4+
import {PCShareSocialNetwork, ShareBLockModel, ShareBlockProps} from '../../../models';
65
import Share from '../Share';
76

87
import data from './data.json';
98

109
export default {
1110
component: Share,
1211
title: 'Blocks/Share',
12+
argTypes: {
13+
items: {
14+
control: {type: 'check'},
15+
options: Object.values(PCShareSocialNetwork),
16+
},
17+
},
1318
} as Meta;
1419

15-
uikitConfigure({lang: UIKitLang.En});
16-
1720
const DefaultTemplate: StoryFn<ShareBLockModel> = (args) => (
18-
<PageConstructor content={{blocks: [args]}} />
21+
<Share {...(blockTransform(args) as ShareBlockProps)} />
1922
);
2023

2124
export const Default = DefaultTemplate.bind({});
2225
export const CustomTitle = DefaultTemplate.bind({});
2326

24-
Default.args = data.default.content as ShareBlockProps;
25-
CustomTitle.args = data.customTitle.content as ShareBlockProps;
27+
Default.args = data.default.content as ShareBLockModel;
28+
Default.parameters = {
29+
controls: {
30+
include: ['title', 'items'],
31+
},
32+
};
33+
34+
CustomTitle.args = data.customTitle.content as ShareBLockModel;
35+
CustomTitle.parameters = {
36+
controls: {
37+
include: ['title', 'items'],
38+
},
39+
};

0 commit comments

Comments
 (0)