File size: 3,088 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* eslint-disable no-console */
import { Button, FoldableCard } from '..';

export default { title: 'Unaudited/FoldableCard' };

export const Default = () => (
	<FoldableCard header="This is a foldable card" screenReaderText="More">
		These are its contents
	</FoldableCard>
);

export const Smooth = () => (
	<FoldableCard
		header="This is a foldable card with smooth animation"
		screenReaderText="More"
		smooth
		contentExpandedStyle={ { maxHeight: '112px' } }
	>
		<div style={ { padding: '16px 16px 0' } }>
			<p>These are its contents</p>
			<p>And some more</p>
		</div>
	</FoldableCard>
);

export const WithLongHeader = () => (
	<FoldableCard
		header="This is a foldable card with a really long header content area that might wrap depending on the page width of the browser being used to view this page when the summary area is not hidden."
		screenReaderText="More"
	>
		These are the card's contents.
	</FoldableCard>
);

export const WithLongHeaderAndHiddenSummary = () => (
	<FoldableCard
		header="This is a foldable card with a really long header content area that might wrap depending on the page width of the browser being used to view this page when the summary area is hidden."
		hideSummary
		screenReaderText="More"
	>
		These are the card's contents.
	</FoldableCard>
);

export const Compact = () => (
	<FoldableCard header="This is a compact card" compact screenReaderText="More">
		I'm tiny! :D
	</FoldableCard>
);

export const Disabled = () => (
	<div>
		<FoldableCard header="This is a disabled card" disabled screenReaderText="More">
			You can't see me!
		</FoldableCard>
	</div>
);

export const Highlighted = () => (
	<FoldableCard header="This is a highlighted card" highlight="info" screenReaderText="More">
		I'm highlighted!
	</FoldableCard>
);

export const WithCustomActionIcon = () => (
	<FoldableCard
		header="This is a foldable card with a custom action icon"
		icon="arrow-down"
		screenReaderText="More"
	>
		These are its contents
	</FoldableCard>
);

export const WithCustomSummary = () => (
	<FoldableCard
		header="This is a compact box with summary"
		summary="Unexpanded Summary"
		expandedSummary="Expanded Summary"
		screenReaderText="More"
	>
		This is the main content of the card.
	</FoldableCard>
);

export const WithMultilineHeader = () => (
	<FoldableCard
		header={
			<div>
				<div>This is a multiline foldable card</div>
				<div>
					<small> with a summary component & a expanded summary component</small>
				</div>
			</div>
		}
		summary={
			<Button compact scary>
				Update
			</Button>
		}
		expandedSummary={
			<Button compact scary>
				Update
			</Button>
		}
	>
		Nothing to see here. Keep walking!
	</FoldableCard>
);

export const WithClickOpenCloseActions = () => (
	<FoldableCard
		header="This card includes click, open and close actions. Check your console!"
		onClick={ function () {
			console.log( 'Clicked!' );
		} }
		onClose={ function () {
			console.log( 'Closed!' );
		} }
		onOpen={ function () {
			console.log( 'Opened!' );
		} }
	>
		Nothing to see here. Keep walking!
	</FoldableCard>
);