Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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.
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.
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.
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.
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.
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.
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.
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.
29 changes: 8 additions & 21 deletions src/blocks/Tabs/__stories__/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import * as React from 'react';

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

import {yfmTransform} from '../../../../.storybook/utils';
import {PageConstructor} from '../../../containers/PageConstructor';
import {blockTransform} from '../../../../.storybook/utils';
import {TabsBlockModel, TabsBlockProps} from '../../../models';
import Tabs from '../Tabs';
import Tabs, {TabsBlock} from '../Tabs';

import data from './data.json';

Expand All @@ -18,7 +17,9 @@ export default {
} as Meta;

const DefaultTemplate: StoryFn<TabsBlockModel> = (args) => (
<PageConstructor content={{blocks: [args]}} />
<div style={{padding: 64, display: 'flex', gap: 20, flexDirection: 'column'}}>
<TabsBlock {...(blockTransform(args) as TabsBlockProps)} />
</div>
);

const ButtonsColSizesTemplate: StoryFn<TabsBlockModel> = (args) => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand Down Expand Up @@ -52,25 +53,11 @@ export const Direction = DirectionTemplate.bind({});
export const Caption = DefaultTemplate.bind({});
export const MediaBorder = DefaultTemplate.bind({});

const DefaultArgs = {
...data.default.content,
items: data.default.content.items.map((item) => ({
...item,
text: yfmTransform(item.text),
list:
item.list &&
item.list.map((listItem) => ({
...listItem,
text: yfmTransform(listItem.text),
})),
additionalInfo: item.additionalInfo && yfmTransform(item.additionalInfo),
caption: item.caption && yfmTransform(item.caption),
})),
};
const DefaultArgs = data.default.content;

Default.args = {
...DefaultArgs,
description: yfmTransform(data.description),
description: data.description,
} as TabsBlockProps;

OnlyMedia.args = {
Expand Down Expand Up @@ -110,7 +97,7 @@ TabsButtonsColSizes.args = {

Centered.args = {
...DefaultArgs,
description: yfmTransform(data.description),
description: data.description,
centered: true,
} as TabsBlockModel;

Expand Down
6 changes: 6 additions & 0 deletions src/text-transform/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ export const config: BlocksConfig = {
parser: parseItemsTitle,
renderInline: true,
},
{
fields: ['items'],
transformer: yfmTransformer,
parser: createItemsParser(['list.text']),
renderInline: true,
},
],
[BlockType.TableBlock]: [
{
Expand Down