File size: 3,591 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
128
129
130
131
132
133
134
135
136
137
138
/* eslint-disable no-console */
import { PureComponent } from 'react';
import { Button, FoldableCard } from '../..';

export default class FoldableCardExample extends PureComponent {
	static displayName = 'FoldableCardExample';

	static defaultProps = {
		exampleCode: (
			<div>
				<div>
					<FoldableCard header="This is a foldable card" screenReaderText="More">
						These are its contents
					</FoldableCard>
				</div>
				<div>
					<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>
				</div>
				<div>
					<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>
				</div>
				<div>
					<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>
				</div>
				<div>
					<FoldableCard header="This is a compact card" compact screenReaderText="More">
						I'm tiny! :D
					</FoldableCard>
				</div>
				<div>
					<div>
						<FoldableCard header="This is a disabled card" disabled screenReaderText="More">
							You can't see me!
						</FoldableCard>
					</div>
				</div>
				<div>
					<FoldableCard
						header="This is a highlighted card"
						highlight="info"
						screenReaderText="More"
					>
						I'm highlighted!
					</FoldableCard>
				</div>
				<div>
					<FoldableCard
						header="This is a foldable card with a custom action icon"
						icon="arrow-down"
						screenReaderText="More"
					>
						These are its contents
					</FoldableCard>
				</div>
				<div>
					<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>
				</div>
				<div>
					<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>
				</div>
				<div>
					<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>
				</div>
			</div>
		),
	};

	handleClick = () => console.log( 'Clicked!' );
	handleClose = () => console.log( 'Closed!' );
	handleOpen = () => console.log( 'Opened!' );

	render() {
		return this.props.exampleCode;
	}
}