-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
index.tsx
75 lines (70 loc) · 1.61 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* External dependencies
*/
import type { ComponentMeta, ComponentStory } from '@storybook/react';
/**
* Internal dependencies
*/
import {
Card,
CardHeader,
CardBody,
CardDivider,
CardMedia,
CardFooter,
} from '..';
import { Text } from '../../text';
import { Heading } from '../../heading';
import Button from '../../button';
const meta: ComponentMeta< typeof Card > = {
component: Card,
title: 'Components/Card',
subcomponents: { CardHeader, CardBody, CardDivider, CardMedia, CardFooter },
argTypes: {
as: {
control: { type: null },
},
children: {
control: { type: null },
},
},
parameters: {
controls: {
expanded: true,
},
docs: { source: { state: 'open' } },
},
};
export default meta;
const Template: ComponentStory< typeof Card > = ( args ) => {
return (
<div style={ { maxWidth: '280px' } }>
<Card { ...args }>
<CardHeader>
<Heading>CardHeader</Heading>
</CardHeader>
<CardBody>
<Text>CardBody</Text>
</CardBody>
<CardBody>
<Text>CardBody (before CardDivider)</Text>
</CardBody>
<CardDivider />
<CardBody>
<Text>CardBody (after CardDivider)</Text>
</CardBody>
<CardMedia>
<img
alt="Card Media"
src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
/>
</CardMedia>
<CardFooter>
<Text>CardFooter</Text>
<Button variant="secondary">Action Button</Button>
</CardFooter>
</Card>
</div>
);
};
export const Default: ComponentStory< typeof Card > = Template.bind( {} );