Skip to content

Commit

Permalink
Migrate molecules from CSF 2 to CSF 3
Browse files Browse the repository at this point in the history
  • Loading branch information
saulprl committed Jul 21, 2023
1 parent a510b9e commit 61f8ff9
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 86 deletions.
36 changes: 15 additions & 21 deletions app/components/molecules/perk-info/perk-info.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
import {ComponentMeta, ComponentStory} from '@storybook/react';
import {Meta, StoryObj} from '@storybook/react';

import {PerkInfo} from './perk-info.component';

export default {
title: 'Molecules/PerkInfo',
component: PerkInfo,
} as ComponentMeta<typeof PerkInfo>;
} as Meta<typeof PerkInfo>;

const Template: ComponentStory<typeof PerkInfo> = (args) => (
<PerkInfo {...args} />
);
type Story = StoryObj<typeof PerkInfo>;

export const GamesPerk = Template.bind({});
GamesPerk.args = {
icon: 'games',
children: 'Juegos de mesa',
export const GamesPerk: Story = {
render: (args) => <PerkInfo {...args} />,
args: {icon: 'games', children: 'Juegos de mesa'},
};

export const EventsPerk = Template.bind({});
EventsPerk.args = {
icon: 'events',
children: 'Hosteo de eventos',
export const EventsPerk: Story = {
render: (args) => <PerkInfo {...args} />,
args: {icon: 'events', children: 'Hosteo de eventos'},
};

export const IngredientsPerk = Template.bind({});
IngredientsPerk.args = {
icon: 'ingredients',
children: 'Ingredientes 100% naturales',
export const IngredientsPerk: Story = {
render: (args) => <PerkInfo {...args} />,
args: {icon: 'ingredients', children: 'Ingredientes 100% naturales'},
};

export const InternetPerk = Template.bind({});
InternetPerk.args = {
icon: 'internet',
children: 'Internet Rápido',
export const InternetPerk: Story = {
render: (args) => <PerkInfo {...args} />,
args: {icon: 'internet', children: 'Internet Rápido'},
};
52 changes: 35 additions & 17 deletions app/components/molecules/promotion-card/promotion-card.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
import {ComponentMeta, ComponentStory} from '@storybook/react';
import {Meta, StoryObj} from '@storybook/react';

import {PromotionCard} from './promotion-card.component';
import {CustomLink} from '../../atoms/link';

export default {
title: 'Molecules/PromotionCard',
component: PromotionCard,
} as ComponentMeta<typeof PromotionCard>;
} as Meta<typeof PromotionCard>;

const Template: ComponentStory<typeof PromotionCard> = (args) => (
<PromotionCard {...args} />
);
type Story = StoryObj<typeof PromotionCard>;

export const Default = Template.bind({});
Default.args = {
image: 'https://placehold.co/600x800.png',
label: 'Latte pilonsillo',
export const Default: Story = {
render: (args) => (
<div style={{width: '280px'}}>
<PromotionCard {...args} />
</div>
),
args: {
image: 'https://placehold.co/600x800.png',
label: 'Latte pilonsillo',
linkRender: (props) => <CustomLink {...props} />,
},
};

export const IsRecommended = Template.bind({});
IsRecommended.args = {
...Default.args,
isRecommended: true,
export const IsRecommended: Story = {
render: (args) => (
<div style={{width: '280px'}}>
<PromotionCard {...args} />
</div>
),
args: {
...Default.args,
isRecommended: true,
},
};

export const IsSeasonal = Template.bind({});
IsSeasonal.args = {
...Default.args,
isSeasonal: true,
export const IsSeasonal: Story = {
render: (args) => (
<div style={{width: '280px'}}>
<PromotionCard {...args} />
</div>
),
args: {
...Default.args,
isSeasonal: true,
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ComponentMeta, ComponentStory} from '@storybook/react';
import {Meta, StoryObj} from '@storybook/react';

import {
FacebookButton,
Expand All @@ -8,33 +8,65 @@ import {

export default {
title: 'Molecules/SocialMediaButton',
} as ComponentMeta<typeof FacebookButton>;

const Template: ComponentStory<typeof FacebookButton> = (args) => (
<div
style={{
display: 'flex',
gap: '1em',
backgroundColor: '#9f7d7d',
padding: '1em',
}}
>
<FacebookButton {...args} />
<InstagramButton {...args} />
<TwitterButton {...args} />
</div>
);

export const Default = Template.bind({});
Default.args = {
size: 36,
href: '#',
inverted: false,
} as Meta<typeof FacebookButton>;

type Story = StoryObj;

export const Default: Story = {
render: (args) => (
<div
style={{
display: 'flex',
gap: '1em',
backgroundColor: '#9f7d7d',
padding: '1em',
}}
>
<FacebookButton href="#" {...args} />
<InstagramButton href="#" {...args} />
<TwitterButton href="#" {...args} />
</div>
),

args: {
size: 36,
href: '#',
inverted: false,
},
};

export const Inverted = Template.bind({});
Inverted.args = {
size: 36,
href: '#',
inverted: true,
export const Inverted: Story = {
render: (args) => (
<div
style={{
display: 'flex',
gap: '1em',
backgroundColor: '#9f7d7d',
padding: '1em',
}}
>
<FacebookButton href="#" {...args} />
<InstagramButton href="#" {...args} />
<TwitterButton href="#" {...args} />
</div>
),

args: {
...Default.args,
inverted: true,
},
};

// export const Default = Template.bind({});
// Default.args = {
// size: 36,
// href: '#',
// inverted: false,
// };

// export const Inverted = Template.bind({});
// Inverted.args = {
// size: 36,
// href: '#',
// inverted: true,
// };
46 changes: 26 additions & 20 deletions app/components/molecules/subtitle/subtitle.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {ComponentMeta, ComponentStory} from '@storybook/react';
import {Meta, StoryObj} from '@storybook/react';

import {Subtitle} from './subtitle.component';
import {TitleSectionProps} from './subtitle.styles';

export default {
title: 'Molecules/Subtitle',
} as ComponentMeta<typeof Subtitle>;
} as Meta<typeof Subtitle>;

type Story = StoryObj<typeof Subtitle>;

const sampleSubtitles: Array<{title: string; icon: TitleSectionProps['icon']}> =
[
Expand All @@ -22,22 +24,26 @@ const sampleNumerals: Array<{title: string; numeral: string}> = [
{title: 'Lorem Ipsum', numeral: '4.'},
];

export const Default: ComponentStory<typeof Subtitle> = () => (
<div style={{display: 'flex', flexDirection: 'column', gap: '2em'}}>
{sampleSubtitles.map(({title, icon}) => (
<Subtitle key={title} icon={icon}>
{title}
</Subtitle>
))}
</div>
);
export const Default: Story = {
render: () => (
<div style={{display: 'flex', flexDirection: 'column', gap: '2em'}}>
{sampleSubtitles.map(({title, icon}) => (
<Subtitle key={title} icon={icon}>
{title}
</Subtitle>
))}
</div>
),
};

export const Numerals: ComponentStory<typeof Subtitle> = () => (
<div style={{display: 'flex', flexDirection: 'column', gap: '2em'}}>
{sampleNumerals.map(({title, numeral}) => (
<Subtitle key={title} numeral={numeral}>
{title}
</Subtitle>
))}
</div>
);
export const Numerals: Story = {
render: () => (
<div style={{display: 'flex', flexDirection: 'column', gap: '2em'}}>
{sampleNumerals.map(({title, numeral}) => (
<Subtitle key={title} numeral={numeral}>
{title}
</Subtitle>
))}
</div>
),
};

0 comments on commit 61f8ff9

Please sign in to comment.