-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.tsx
92 lines (86 loc) · 1.94 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* 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 ) => (
<Card { ...args } />
);
export const Default = Template.bind( {} );
Default.args = {
children: (
<>
<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>
</>
),
};
/**
* `CardMedia` provides a container for full-bleed content within a `Card`,
* such as images, video, or even just a background color. The corners will be rounded if necessary.
*/
export const FullBleedContent = Template.bind( {} );
FullBleedContent.args = {
...Default.args,
children: (
<CardMedia>
<div style={ { padding: 16, background: 'beige' } }>
Some full bleed content
</div>
</CardMedia>
),
};