Skip to content
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
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.
58 changes: 38 additions & 20 deletions src/sub-blocks/Quote/__stories__/Quote.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,64 @@
import {Meta, StoryFn} from '@storybook/react';

import {yfmTransformInline} from '../../../../.storybook/utils';
import {QuoteProps, QuoteType} from '../../../models';
import {blockTransform} from '../../../../.storybook/utils';
import {QuoteModel, QuoteProps, QuoteType} from '../../../models';
import Quote from '../Quote';

import data from './data.json';

export default {
title: 'Components/Cards/Quote',
component: Quote,
args: {
border: 'shadow',
theme: 'light',
argTypes: {
color: {control: 'color'},
},
argTypes: {color: {control: 'color'}},
} as Meta;

const DefaultTemplate: StoryFn<QuoteProps> = (args) => (
const DefaultTemplate: StoryFn<QuoteModel> = (args) => (
<div style={{maxWidth: '1248px'}}>
<Quote {...args} />
<Quote {...(blockTransform(args) as QuoteProps)} />
</div>
);
const QuoteTypesTemplate: StoryFn<QuoteProps> = (args) => (

const QuoteTypesTemplate: StoryFn<Record<string, QuoteModel>> = (args) => (
<div style={{maxWidth: '1248px', display: 'flex', flexDirection: 'column', gap: '24px'}}>
<Quote {...args} quoteType={QuoteType.Chevron} />
<Quote {...args} quoteType={QuoteType.EnglishDouble} />
{Object.entries(args)
.map(([key, item]) => {
const transformedArgs = blockTransform(item) as QuoteProps;
return <Quote key={key} {...transformedArgs} />;
})
.filter(Boolean)}
</div>
);

export const Default = DefaultTemplate.bind({});
export const QuoteTypes = QuoteTypesTemplate.bind({});
Copy link
Collaborator

Choose a reason for hiding this comment

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

export const BorderLine = DefaultTemplate.bind({});
export const DarkTheme = DefaultTemplate.bind({});

const DefaultArgs = {
...data.default.content,
yfmText: yfmTransformInline(data.default.content.yfmText),
} as QuoteProps;
Default.args = data.default.content as QuoteModel;

Default.args = DefaultArgs;
QuoteTypes.args = DefaultArgs;
BorderLine.args = {
...DefaultArgs,
...data.default.content,
...data.borderLine.content,
} as QuoteProps;
DarkTheme.args = data.darkTheme.content as QuoteProps;
} as QuoteModel;

DarkTheme.args = data.darkTheme.content as QuoteModel;

const QUOTE_TYPES: Record<string, QuoteModel> = {
0: {
...data.default.content,
quoteType: QuoteType.Chevron,
} as QuoteModel,
1: {
...data.default.content,
quoteType: QuoteType.EnglishDouble,
} as QuoteModel,
};

QuoteTypes.args = QUOTE_TYPES;
QuoteTypes.parameters = {
controls: {
include: Object.keys(QUOTE_TYPES),
},
};