Skip to content

Commit 75a4c58

Browse files
authored
chore: update companies story block transform (#1245)
* chore: update companies story block transform
1 parent 41d87f9 commit 75a4c58

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed
-1.42 KB
Loading
-2.83 KB
Loading
Loading
Loading
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {Meta, StoryFn} from '@storybook/react';
22

3-
import {yfmTransform} from '../../../../.storybook/utils';
4-
import {PageConstructor} from '../../../containers/PageConstructor/PageConstructor';
3+
import {blockTransform} from '../../../../.storybook/utils';
54
import {CompaniesBlockModel, CompaniesBlockProps} from '../../../models';
65
import Companies from '../Companies';
76

@@ -10,23 +9,21 @@ import data from './data.json';
109
export default {
1110
title: 'Blocks/Companies',
1211
component: Companies,
12+
parameters: {
13+
controls: {
14+
exclude: ['type'],
15+
},
16+
},
1317
} as Meta;
1418

15-
const DefaultTemplate: StoryFn<CompaniesBlockModel> = (args) => (
16-
<PageConstructor content={{blocks: [args]}} />
17-
);
18-
19-
const WithDescriptionTemplate: StoryFn<CompaniesBlockModel> = (args) => (
20-
<PageConstructor content={{blocks: [args]}} />
21-
);
19+
const DefaultTemplate: StoryFn<CompaniesBlockModel> = (args) => {
20+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
21+
const {type, ...props} = blockTransform(args);
22+
return <Companies {...(props as CompaniesBlockProps)} />;
23+
};
2224

2325
export const Default = DefaultTemplate.bind({});
24-
export const WithDescription = WithDescriptionTemplate.bind({});
25-
26-
const transformedText = yfmTransform(data.withDescription.content.description);
26+
export const WithDescription = DefaultTemplate.bind({});
2727

28-
Default.args = data.default.content as CompaniesBlockProps;
29-
WithDescription.args = {
30-
...data.withDescription.content,
31-
description: transformedText,
32-
} as CompaniesBlockProps;
28+
Default.args = data.default.content as CompaniesBlockModel;
29+
WithDescription.args = data.withDescription.content as CompaniesBlockModel;

src/blocks/Companies/schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const CompaniesBlock = {
1313
},
1414
description: {
1515
type: 'string',
16-
contentType: 'text',
16+
contentType: 'yfm',
17+
inputType: 'textarea',
1718
},
1819
images: withTheme({
1920
type: 'object',

0 commit comments

Comments
 (0)