@sproutsocial/seeds-react-content-block 0.5.3 → 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/content-block.css +48 -0
- package/dist/esm/index.js +221 -32
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +218 -32
- package/dist/index.js.map +1 -1
- package/package.json +21 -9
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -4
- package/.turbo/turbo-build.log +0 -21
- package/CHANGELOG.md +0 -324
- package/jest.config.js +0 -9
- package/src/ContentBlock.stories.tsx +0 -189
- package/src/ContentBlock.tsx +0 -198
- package/src/__tests__/content-block.test.tsx +0 -280
- package/src/index.ts +0 -6
- package/src/styled.d.ts +0 -7
- package/src/styles.ts +0 -19
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -12
package/CHANGELOG.md
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
# @sproutsocial/seeds-react-content-block
|
|
2
|
-
|
|
3
|
-
## 0.5.3
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- @sproutsocial/seeds-react-button@2.0.5
|
|
8
|
-
- @sproutsocial/seeds-react-content-header@0.2.11
|
|
9
|
-
|
|
10
|
-
## 0.5.2
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- @sproutsocial/seeds-react-button@2.0.4
|
|
15
|
-
- @sproutsocial/seeds-react-content-header@0.2.10
|
|
16
|
-
|
|
17
|
-
## 0.5.1
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- @sproutsocial/seeds-react-button@2.0.3
|
|
22
|
-
- @sproutsocial/seeds-react-content-header@0.2.9
|
|
23
|
-
|
|
24
|
-
## 0.5.0
|
|
25
|
-
|
|
26
|
-
### Minor Changes
|
|
27
|
-
|
|
28
|
-
- eb6937d: Add optional `footerContent` and `footerActions` props for a styled footer area below the content, and `flushLayout` boolean prop to set content area padding to 0
|
|
29
|
-
|
|
30
|
-
### Patch Changes
|
|
31
|
-
|
|
32
|
-
- Updated dependencies [eb6937d]
|
|
33
|
-
- @sproutsocial/seeds-react-content-header@0.2.8
|
|
34
|
-
|
|
35
|
-
## 0.4.1
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- @sproutsocial/seeds-react-button@2.0.2
|
|
40
|
-
- @sproutsocial/seeds-react-content-header@0.2.7
|
|
41
|
-
|
|
42
|
-
## 0.4.0
|
|
43
|
-
|
|
44
|
-
### Minor Changes
|
|
45
|
-
|
|
46
|
-
- 43380e5: Subtitle is now an optional prop
|
|
47
|
-
|
|
48
|
-
## 0.3.7
|
|
49
|
-
|
|
50
|
-
### Patch Changes
|
|
51
|
-
|
|
52
|
-
- @sproutsocial/seeds-react-button@2.0.1
|
|
53
|
-
- @sproutsocial/seeds-react-content-header@0.2.6
|
|
54
|
-
|
|
55
|
-
## 0.3.6
|
|
56
|
-
|
|
57
|
-
### Patch Changes
|
|
58
|
-
|
|
59
|
-
- Updated dependencies [4ba8720]
|
|
60
|
-
- Updated dependencies [df9d751]
|
|
61
|
-
- @sproutsocial/seeds-react-theme@3.6.2
|
|
62
|
-
- @sproutsocial/seeds-react-button@2.0.0
|
|
63
|
-
- @sproutsocial/seeds-react-box@1.1.16
|
|
64
|
-
- @sproutsocial/seeds-react-container@0.3.10
|
|
65
|
-
- @sproutsocial/seeds-react-loader@1.0.16
|
|
66
|
-
- @sproutsocial/seeds-react-content-header@0.2.5
|
|
67
|
-
|
|
68
|
-
## 0.3.5
|
|
69
|
-
|
|
70
|
-
### Patch Changes
|
|
71
|
-
|
|
72
|
-
- Updated dependencies [1f9a473]
|
|
73
|
-
- @sproutsocial/seeds-react-theme@3.6.1
|
|
74
|
-
- @sproutsocial/seeds-react-box@1.1.15
|
|
75
|
-
- @sproutsocial/seeds-react-container@0.3.9
|
|
76
|
-
- @sproutsocial/seeds-react-loader@1.0.15
|
|
77
|
-
- @sproutsocial/seeds-react-content-header@0.2.4
|
|
78
|
-
- @sproutsocial/seeds-react-button@1.4.3
|
|
79
|
-
|
|
80
|
-
## 0.3.4
|
|
81
|
-
|
|
82
|
-
### Patch Changes
|
|
83
|
-
|
|
84
|
-
- @sproutsocial/seeds-react-button@1.4.2
|
|
85
|
-
- @sproutsocial/seeds-react-content-header@0.2.3
|
|
86
|
-
|
|
87
|
-
## 0.3.3
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- @sproutsocial/seeds-react-button@1.4.1
|
|
92
|
-
- @sproutsocial/seeds-react-content-header@0.2.2
|
|
93
|
-
|
|
94
|
-
## 0.3.2
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- Updated dependencies [7d54d67]
|
|
99
|
-
- @sproutsocial/seeds-react-button@1.4.0
|
|
100
|
-
|
|
101
|
-
## 0.3.1
|
|
102
|
-
|
|
103
|
-
### Patch Changes
|
|
104
|
-
|
|
105
|
-
- Updated dependencies [17d4f12]
|
|
106
|
-
- @sproutsocial/seeds-react-theme@3.6.0
|
|
107
|
-
- @sproutsocial/seeds-react-box@1.1.14
|
|
108
|
-
- @sproutsocial/seeds-react-container@0.3.8
|
|
109
|
-
- @sproutsocial/seeds-react-loader@1.0.14
|
|
110
|
-
- @sproutsocial/seeds-react-content-header@0.2.1
|
|
111
|
-
- @sproutsocial/seeds-react-button@1.3.20
|
|
112
|
-
|
|
113
|
-
## 0.3.0
|
|
114
|
-
|
|
115
|
-
### Minor Changes
|
|
116
|
-
|
|
117
|
-
- 5bb63e1: ContentBlock now uses ContentHeader/CollapsibleContentHeader internally and supports optional collapsible behavior via isCollapsible prop.
|
|
118
|
-
|
|
119
|
-
### Patch Changes
|
|
120
|
-
|
|
121
|
-
- Updated dependencies [5bb63e1]
|
|
122
|
-
- Updated dependencies [5bb63e1]
|
|
123
|
-
- @sproutsocial/seeds-react-content-header@0.2.0
|
|
124
|
-
- @sproutsocial/seeds-react-container@0.3.7
|
|
125
|
-
- @sproutsocial/seeds-react-button@1.3.19
|
|
126
|
-
- @sproutsocial/seeds-react-loader@1.0.13
|
|
127
|
-
|
|
128
|
-
## 0.2.13
|
|
129
|
-
|
|
130
|
-
### Patch Changes
|
|
131
|
-
|
|
132
|
-
- Updated dependencies [118e300]
|
|
133
|
-
- @sproutsocial/seeds-react-theme@3.5.1
|
|
134
|
-
- @sproutsocial/seeds-react-box@1.1.13
|
|
135
|
-
- @sproutsocial/seeds-react-container@0.3.6
|
|
136
|
-
- @sproutsocial/seeds-react-icon@2.2.4
|
|
137
|
-
- @sproutsocial/seeds-react-loader@1.0.12
|
|
138
|
-
- @sproutsocial/seeds-react-button@1.3.18
|
|
139
|
-
|
|
140
|
-
## 0.2.12
|
|
141
|
-
|
|
142
|
-
### Patch Changes
|
|
143
|
-
|
|
144
|
-
- @sproutsocial/seeds-react-icon@2.2.3
|
|
145
|
-
- @sproutsocial/seeds-react-button@1.3.17
|
|
146
|
-
|
|
147
|
-
## 0.2.11
|
|
148
|
-
|
|
149
|
-
### Patch Changes
|
|
150
|
-
|
|
151
|
-
- Updated dependencies [131db40]
|
|
152
|
-
- @sproutsocial/seeds-react-icon@2.2.2
|
|
153
|
-
- @sproutsocial/seeds-react-button@1.3.16
|
|
154
|
-
|
|
155
|
-
## 0.2.10
|
|
156
|
-
|
|
157
|
-
### Patch Changes
|
|
158
|
-
|
|
159
|
-
- @sproutsocial/seeds-react-icon@2.2.1
|
|
160
|
-
- @sproutsocial/seeds-react-button@1.3.15
|
|
161
|
-
|
|
162
|
-
## 0.2.9
|
|
163
|
-
|
|
164
|
-
### Patch Changes
|
|
165
|
-
|
|
166
|
-
- Updated dependencies [db6ce39]
|
|
167
|
-
- Updated dependencies [20bb01b]
|
|
168
|
-
- Updated dependencies [c7f2c70]
|
|
169
|
-
- @sproutsocial/seeds-react-theme@3.5.0
|
|
170
|
-
- @sproutsocial/seeds-react-icon@2.2.0
|
|
171
|
-
- @sproutsocial/seeds-react-box@1.1.12
|
|
172
|
-
- @sproutsocial/seeds-react-container@0.3.5
|
|
173
|
-
- @sproutsocial/seeds-react-loader@1.0.11
|
|
174
|
-
- @sproutsocial/seeds-react-button@1.3.14
|
|
175
|
-
|
|
176
|
-
## 0.2.8
|
|
177
|
-
|
|
178
|
-
### Patch Changes
|
|
179
|
-
|
|
180
|
-
- Updated dependencies [29ced53]
|
|
181
|
-
- @sproutsocial/seeds-react-text@1.4.0
|
|
182
|
-
|
|
183
|
-
## 0.2.7
|
|
184
|
-
|
|
185
|
-
### Patch Changes
|
|
186
|
-
|
|
187
|
-
- Updated dependencies [7716e16]
|
|
188
|
-
- @sproutsocial/seeds-react-theme@3.4.0
|
|
189
|
-
- @sproutsocial/seeds-react-box@1.1.11
|
|
190
|
-
- @sproutsocial/seeds-react-container@0.3.4
|
|
191
|
-
- @sproutsocial/seeds-react-icon@2.1.2
|
|
192
|
-
- @sproutsocial/seeds-react-loader@1.0.10
|
|
193
|
-
- @sproutsocial/seeds-react-button@1.3.13
|
|
194
|
-
|
|
195
|
-
## 0.2.6
|
|
196
|
-
|
|
197
|
-
### Patch Changes
|
|
198
|
-
|
|
199
|
-
- @sproutsocial/seeds-react-theme@3.3.2
|
|
200
|
-
- @sproutsocial/seeds-react-box@1.1.10
|
|
201
|
-
- @sproutsocial/seeds-react-container@0.3.3
|
|
202
|
-
- @sproutsocial/seeds-react-icon@2.1.1
|
|
203
|
-
- @sproutsocial/seeds-react-loader@1.0.9
|
|
204
|
-
- @sproutsocial/seeds-react-button@1.3.12
|
|
205
|
-
|
|
206
|
-
## 0.2.5
|
|
207
|
-
|
|
208
|
-
### Patch Changes
|
|
209
|
-
|
|
210
|
-
- Updated dependencies [b147e07]
|
|
211
|
-
- @sproutsocial/seeds-react-icon@2.1.0
|
|
212
|
-
- @sproutsocial/seeds-react-button@1.3.11
|
|
213
|
-
|
|
214
|
-
## 0.2.4
|
|
215
|
-
|
|
216
|
-
### Patch Changes
|
|
217
|
-
|
|
218
|
-
- @sproutsocial/seeds-react-theme@3.3.1
|
|
219
|
-
- @sproutsocial/seeds-react-box@1.1.9
|
|
220
|
-
- @sproutsocial/seeds-react-container@0.3.2
|
|
221
|
-
- @sproutsocial/seeds-react-icon@2.0.5
|
|
222
|
-
- @sproutsocial/seeds-react-loader@1.0.8
|
|
223
|
-
- @sproutsocial/seeds-react-button@1.3.10
|
|
224
|
-
|
|
225
|
-
## 0.2.3
|
|
226
|
-
|
|
227
|
-
### Patch Changes
|
|
228
|
-
|
|
229
|
-
- Updated dependencies [750d1ea]
|
|
230
|
-
- @sproutsocial/seeds-react-theme@3.3.0
|
|
231
|
-
- @sproutsocial/seeds-react-button@1.3.9
|
|
232
|
-
- @sproutsocial/seeds-react-loader@1.0.7
|
|
233
|
-
- @sproutsocial/seeds-react-box@1.1.8
|
|
234
|
-
- @sproutsocial/seeds-react-container@0.3.1
|
|
235
|
-
- @sproutsocial/seeds-react-icon@2.0.4
|
|
236
|
-
|
|
237
|
-
## 0.2.2
|
|
238
|
-
|
|
239
|
-
### Patch Changes
|
|
240
|
-
|
|
241
|
-
- e056fd7: Update ContentBlock to use children prop instead of content
|
|
242
|
-
|
|
243
|
-
## 0.2.1
|
|
244
|
-
|
|
245
|
-
### Patch Changes
|
|
246
|
-
|
|
247
|
-
- @sproutsocial/seeds-react-icon@2.0.3
|
|
248
|
-
- @sproutsocial/seeds-react-button@1.3.8
|
|
249
|
-
|
|
250
|
-
## 0.2.0
|
|
251
|
-
|
|
252
|
-
### Minor Changes
|
|
253
|
-
|
|
254
|
-
- e2f6976: Refactor ContentBlock to use the shared Container component from seeds-react-container instead of custom styles. This improves consistency across components and simplifies the codebase. Also removes unused type exports from seeds-react-container.
|
|
255
|
-
|
|
256
|
-
### Patch Changes
|
|
257
|
-
|
|
258
|
-
- Updated dependencies [e2f6976]
|
|
259
|
-
- @sproutsocial/seeds-react-container@0.3.0
|
|
260
|
-
|
|
261
|
-
## 0.1.0
|
|
262
|
-
|
|
263
|
-
### Minor Changes
|
|
264
|
-
|
|
265
|
-
- 1de0863: **Breaking Changes**
|
|
266
|
-
|
|
267
|
-
`@sproutsocial/seeds-react-container` has been simplified to a basic styled container component. It now only provides border, background, and border-radius styling as a wrapper around Box, accepting all Box props.
|
|
268
|
-
|
|
269
|
-
The previous Container component functionality (with title, subtitle, loading states, and header actions) has been moved to a new package: `@sproutsocial/seeds-react-content-block`.
|
|
270
|
-
|
|
271
|
-
**Migration**
|
|
272
|
-
|
|
273
|
-
If you were using the old Container component with `title`, `subtitle`, `isLoading`, or `headerActions` props, switch to `@sproutsocial/seeds-react-content-block`:
|
|
274
|
-
|
|
275
|
-
```tsx
|
|
276
|
-
// Before
|
|
277
|
-
import { Container } from "@sproutsocial/seeds-react-container";
|
|
278
|
-
|
|
279
|
-
// After
|
|
280
|
-
import { ContentBlock } from "@sproutsocial/seeds-react-content-block";
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
## 0.1.4
|
|
284
|
-
|
|
285
|
-
### Patch Changes
|
|
286
|
-
|
|
287
|
-
- @sproutsocial/seeds-react-icon@2.0.2
|
|
288
|
-
- @sproutsocial/seeds-react-button@1.3.7
|
|
289
|
-
|
|
290
|
-
## 0.1.3
|
|
291
|
-
|
|
292
|
-
### Patch Changes
|
|
293
|
-
|
|
294
|
-
- Updated dependencies [fa7579a]
|
|
295
|
-
- @sproutsocial/seeds-react-theme@3.2.1
|
|
296
|
-
- @sproutsocial/seeds-react-box@1.1.7
|
|
297
|
-
- @sproutsocial/seeds-react-icon@2.0.1
|
|
298
|
-
- @sproutsocial/seeds-react-loader@1.0.6
|
|
299
|
-
- @sproutsocial/seeds-react-button@1.3.6
|
|
300
|
-
|
|
301
|
-
## 0.1.2
|
|
302
|
-
|
|
303
|
-
### Patch Changes
|
|
304
|
-
|
|
305
|
-
- Updated dependencies [40248a0]
|
|
306
|
-
- @sproutsocial/seeds-react-icon@2.0.0
|
|
307
|
-
- @sproutsocial/seeds-react-button@1.3.5
|
|
308
|
-
|
|
309
|
-
## 0.1.1
|
|
310
|
-
|
|
311
|
-
### Patch Changes
|
|
312
|
-
|
|
313
|
-
- Updated dependencies [8f6ba8d]
|
|
314
|
-
- @sproutsocial/seeds-react-theme@3.2.0
|
|
315
|
-
- @sproutsocial/seeds-react-box@1.1.6
|
|
316
|
-
- @sproutsocial/seeds-react-icon@1.1.8
|
|
317
|
-
- @sproutsocial/seeds-react-loader@1.0.5
|
|
318
|
-
- @sproutsocial/seeds-react-button@1.3.4
|
|
319
|
-
|
|
320
|
-
## 0.1.0
|
|
321
|
-
|
|
322
|
-
### Minor Changes
|
|
323
|
-
|
|
324
|
-
- 5f6fee3: Created new component called Container that accepts a title, subtitle, header action, and can display a loading state"
|
package/jest.config.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import ContentBlock from "./ContentBlock";
|
|
3
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import { Text } from "@sproutsocial/seeds-react-text";
|
|
5
|
-
import { Box } from "@sproutsocial/seeds-react-box";
|
|
6
|
-
import { Button } from "@sproutsocial/seeds-react-button";
|
|
7
|
-
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
8
|
-
|
|
9
|
-
const meta: Meta<typeof ContentBlock> = {
|
|
10
|
-
title: "Components/ContentBlock",
|
|
11
|
-
component: ContentBlock,
|
|
12
|
-
args: {
|
|
13
|
-
title: "Volume Breakdown - Outbound",
|
|
14
|
-
subtitle: "View a breakdown of your outbound volume.",
|
|
15
|
-
children: (
|
|
16
|
-
<Text.SmallBodyCopy>
|
|
17
|
-
Here is some content inside the content block.
|
|
18
|
-
</Text.SmallBodyCopy>
|
|
19
|
-
),
|
|
20
|
-
isLoading: false,
|
|
21
|
-
headerActions: null,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
|
|
27
|
-
type Story = StoryObj<typeof ContentBlock>;
|
|
28
|
-
|
|
29
|
-
export const Default: Story = {
|
|
30
|
-
render: (args) => <ContentBlock {...args} />,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const WithoutSubtitle: Story = {
|
|
34
|
-
render: (args) => <ContentBlock {...args} subtitle={undefined} />,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const WithHeaderActions: Story = {
|
|
38
|
-
render: (args) => (
|
|
39
|
-
<ContentBlock
|
|
40
|
-
{...args}
|
|
41
|
-
headerActions={
|
|
42
|
-
<Button size="small">
|
|
43
|
-
<Icon name="face-frown-open-solid" />
|
|
44
|
-
</Button>
|
|
45
|
-
}
|
|
46
|
-
/>
|
|
47
|
-
),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const LoadingState: Story = {
|
|
51
|
-
render: (args) => <ContentBlock {...args} isLoading={true} />,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const WithContentStyles: Story = {
|
|
55
|
-
render: (args) => (
|
|
56
|
-
<ContentBlock {...args} contentProps={{ p: 0, py: 400, bg: "blue.300" }} />
|
|
57
|
-
),
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const WithFooter: Story = {
|
|
61
|
-
render: (args) => (
|
|
62
|
-
<ContentBlock
|
|
63
|
-
{...args}
|
|
64
|
-
footerContent={
|
|
65
|
-
<Text.SmallBodyCopy>Footer description text</Text.SmallBodyCopy>
|
|
66
|
-
}
|
|
67
|
-
footerActions={
|
|
68
|
-
<Button
|
|
69
|
-
href="https://app.sproutsocial.com/dashboard/"
|
|
70
|
-
appearance="secondary"
|
|
71
|
-
>
|
|
72
|
-
See profile performance
|
|
73
|
-
</Button>
|
|
74
|
-
}
|
|
75
|
-
/>
|
|
76
|
-
),
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const WithFlushContent: Story = {
|
|
80
|
-
render: (args) => (
|
|
81
|
-
<ContentBlock
|
|
82
|
-
{...args}
|
|
83
|
-
flushLayout
|
|
84
|
-
footerContent={
|
|
85
|
-
<Text.SmallBodyCopy>Footer description text</Text.SmallBodyCopy>
|
|
86
|
-
}
|
|
87
|
-
>
|
|
88
|
-
<Box p={400}>Impressions</Box>
|
|
89
|
-
<Box p={400} borderTop={500} borderColor="container.border.base">
|
|
90
|
-
Engagements
|
|
91
|
-
</Box>
|
|
92
|
-
<Box p={400} borderTop={500} borderColor="container.border.base">
|
|
93
|
-
Followers Gained
|
|
94
|
-
</Box>
|
|
95
|
-
</ContentBlock>
|
|
96
|
-
),
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const Collapsible: Story = {
|
|
100
|
-
render: (args) => (
|
|
101
|
-
<ContentBlock {...args} isCollapsible>
|
|
102
|
-
<Text.SmallBodyCopy>
|
|
103
|
-
This content can be collapsed and expanded by clicking the header.
|
|
104
|
-
</Text.SmallBodyCopy>
|
|
105
|
-
</ContentBlock>
|
|
106
|
-
),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const CollapsibleDefaultClosed: Story = {
|
|
110
|
-
name: "Collapsible (Default Closed)",
|
|
111
|
-
render: (args) => (
|
|
112
|
-
<ContentBlock {...args} isCollapsible defaultOpen={false}>
|
|
113
|
-
<Text.SmallBodyCopy>
|
|
114
|
-
This content starts collapsed and can be expanded by clicking the
|
|
115
|
-
header.
|
|
116
|
-
</Text.SmallBodyCopy>
|
|
117
|
-
</ContentBlock>
|
|
118
|
-
),
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const CollapsibleWithHeaderActions: Story = {
|
|
122
|
-
name: "Collapsible with Header Actions",
|
|
123
|
-
render: (args) => (
|
|
124
|
-
<ContentBlock
|
|
125
|
-
{...args}
|
|
126
|
-
isCollapsible
|
|
127
|
-
headerActions={
|
|
128
|
-
<Button size="small">
|
|
129
|
-
<Icon name="face-frown-open-solid" />
|
|
130
|
-
</Button>
|
|
131
|
-
}
|
|
132
|
-
>
|
|
133
|
-
<Text.SmallBodyCopy>
|
|
134
|
-
The header actions are independent from the collapse trigger. Clicking
|
|
135
|
-
the action button does not toggle the content.
|
|
136
|
-
</Text.SmallBodyCopy>
|
|
137
|
-
</ContentBlock>
|
|
138
|
-
),
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export const CollapsibleWithFooter: Story = {
|
|
142
|
-
name: "Collapsible with Footer",
|
|
143
|
-
render: (args) => (
|
|
144
|
-
<ContentBlock
|
|
145
|
-
{...args}
|
|
146
|
-
isCollapsible
|
|
147
|
-
footerContent={
|
|
148
|
-
<Text.SmallBodyCopy>Footer description text</Text.SmallBodyCopy>
|
|
149
|
-
}
|
|
150
|
-
footerActions={
|
|
151
|
-
<Button
|
|
152
|
-
href="https://app.sproutsocial.com/dashboard/"
|
|
153
|
-
appearance="secondary"
|
|
154
|
-
>
|
|
155
|
-
See profile performance
|
|
156
|
-
</Button>
|
|
157
|
-
}
|
|
158
|
-
>
|
|
159
|
-
<Text.SmallBodyCopy>
|
|
160
|
-
The footer collapses along with the content.
|
|
161
|
-
</Text.SmallBodyCopy>
|
|
162
|
-
</ContentBlock>
|
|
163
|
-
),
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export const CollapsibleControlled: Story = {
|
|
167
|
-
name: "Collapsible (Controlled)",
|
|
168
|
-
render: (args) => {
|
|
169
|
-
const [isOpen, setIsOpen] = useState(true);
|
|
170
|
-
return (
|
|
171
|
-
<>
|
|
172
|
-
<Button onClick={() => setIsOpen(!isOpen)} mb={400}>
|
|
173
|
-
{isOpen ? "Close" : "Open"} externally
|
|
174
|
-
</Button>
|
|
175
|
-
<ContentBlock
|
|
176
|
-
{...args}
|
|
177
|
-
isCollapsible
|
|
178
|
-
isOpen={isOpen}
|
|
179
|
-
onOpenChange={setIsOpen}
|
|
180
|
-
>
|
|
181
|
-
<Text.SmallBodyCopy>
|
|
182
|
-
This content block is controlled externally. Use the button above or
|
|
183
|
-
click the header to toggle.
|
|
184
|
-
</Text.SmallBodyCopy>
|
|
185
|
-
</ContentBlock>
|
|
186
|
-
</>
|
|
187
|
-
);
|
|
188
|
-
},
|
|
189
|
-
};
|
package/src/ContentBlock.tsx
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { Box } from "@sproutsocial/seeds-react-box";
|
|
3
|
-
import { Loader } from "@sproutsocial/seeds-react-loader";
|
|
4
|
-
import { Collapsible } from "@sproutsocial/seeds-react-collapsible";
|
|
5
|
-
import {
|
|
6
|
-
ContentHeader,
|
|
7
|
-
CollapsibleContentHeader,
|
|
8
|
-
} from "@sproutsocial/seeds-react-content-header";
|
|
9
|
-
import { Container } from "@sproutsocial/seeds-react-container";
|
|
10
|
-
import { FooterContainer } from "./styles";
|
|
11
|
-
|
|
12
|
-
interface ContentBlockBaseProps {
|
|
13
|
-
title: string;
|
|
14
|
-
subtitle?: string;
|
|
15
|
-
titleAs?: "h1" | "h2" | "h3" | "h4";
|
|
16
|
-
subtitleAs?: "h2" | "h3" | "h4" | "h5" | "p";
|
|
17
|
-
isLoading?: boolean;
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
headerActions?: React.ReactNode;
|
|
20
|
-
contentProps?: React.ComponentProps<typeof Box>;
|
|
21
|
-
/** Sets content area padding to 0 */
|
|
22
|
-
flushLayout?: boolean;
|
|
23
|
-
/** Left slot of the footer area */
|
|
24
|
-
footerContent?: React.ReactNode;
|
|
25
|
-
/** Right slot of the footer area */
|
|
26
|
-
footerActions?: React.ReactNode;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type StaticContentBlockProps = ContentBlockBaseProps & {
|
|
30
|
-
isCollapsible?: false;
|
|
31
|
-
isOpen?: never;
|
|
32
|
-
defaultOpen?: never;
|
|
33
|
-
onOpenChange?: never;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
type CollapsibleContentBlockProps = ContentBlockBaseProps & {
|
|
37
|
-
/** Enables collapse/expand behavior on the content area */
|
|
38
|
-
isCollapsible: true;
|
|
39
|
-
/** Controlled open state. When provided, the component is in controlled mode. */
|
|
40
|
-
isOpen?: boolean;
|
|
41
|
-
/** Initial open state for uncontrolled mode. Defaults to true. */
|
|
42
|
-
defaultOpen?: boolean;
|
|
43
|
-
/** Called when the open state changes */
|
|
44
|
-
onOpenChange?: (open: boolean) => void;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type ContentBlockProps =
|
|
48
|
-
| StaticContentBlockProps
|
|
49
|
-
| CollapsibleContentBlockProps;
|
|
50
|
-
|
|
51
|
-
const ContentArea = ({
|
|
52
|
-
isLoading,
|
|
53
|
-
children,
|
|
54
|
-
contentProps,
|
|
55
|
-
flushLayout,
|
|
56
|
-
hasFooter,
|
|
57
|
-
}: Pick<
|
|
58
|
-
ContentBlockBaseProps,
|
|
59
|
-
"isLoading" | "children" | "contentProps" | "flushLayout"
|
|
60
|
-
> & { hasFooter?: boolean }) => (
|
|
61
|
-
<Box
|
|
62
|
-
p={flushLayout ? 0 : 400}
|
|
63
|
-
{...contentProps}
|
|
64
|
-
borderBottomLeftRadius={hasFooter ? undefined : "outer"}
|
|
65
|
-
borderBottomRightRadius={hasFooter ? undefined : "outer"}
|
|
66
|
-
>
|
|
67
|
-
{isLoading ? (
|
|
68
|
-
<Box my={400}>
|
|
69
|
-
<Loader delay={false} />
|
|
70
|
-
</Box>
|
|
71
|
-
) : (
|
|
72
|
-
children
|
|
73
|
-
)}
|
|
74
|
-
</Box>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const ContentFooter = ({
|
|
78
|
-
footerContent,
|
|
79
|
-
footerActions,
|
|
80
|
-
}: {
|
|
81
|
-
footerContent?: React.ReactNode;
|
|
82
|
-
footerActions?: React.ReactNode;
|
|
83
|
-
}) => (
|
|
84
|
-
<FooterContainer>
|
|
85
|
-
{footerContent && <span>{footerContent}</span>}
|
|
86
|
-
{footerActions && <span>{footerActions}</span>}
|
|
87
|
-
</FooterContainer>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const CollapsibleContentBlock = ({
|
|
91
|
-
title,
|
|
92
|
-
subtitle,
|
|
93
|
-
titleAs = "h2",
|
|
94
|
-
subtitleAs = "h3",
|
|
95
|
-
children,
|
|
96
|
-
isLoading,
|
|
97
|
-
headerActions,
|
|
98
|
-
contentProps,
|
|
99
|
-
flushLayout,
|
|
100
|
-
footerContent,
|
|
101
|
-
footerActions,
|
|
102
|
-
isOpen: controlledIsOpen,
|
|
103
|
-
defaultOpen = true,
|
|
104
|
-
onOpenChange,
|
|
105
|
-
}: Omit<CollapsibleContentBlockProps, "isCollapsible">) => {
|
|
106
|
-
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
107
|
-
const open = controlledIsOpen !== undefined ? controlledIsOpen : internalOpen;
|
|
108
|
-
const hasFooter = !!(footerContent || footerActions);
|
|
109
|
-
|
|
110
|
-
const handleOpenChange = (newOpen: boolean) => {
|
|
111
|
-
if (controlledIsOpen === undefined) {
|
|
112
|
-
setInternalOpen(newOpen);
|
|
113
|
-
}
|
|
114
|
-
onOpenChange?.(newOpen);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<Collapsible isOpen={open} onOpenChange={handleOpenChange}>
|
|
119
|
-
<Container as="section">
|
|
120
|
-
<CollapsibleContentHeader
|
|
121
|
-
title={title}
|
|
122
|
-
subtitle={subtitle}
|
|
123
|
-
headingLevel={titleAs}
|
|
124
|
-
subtitleAs={subtitleAs}
|
|
125
|
-
headerActions={headerActions}
|
|
126
|
-
trigger={Collapsible.Trigger}
|
|
127
|
-
triggerPosition="left"
|
|
128
|
-
/>
|
|
129
|
-
<Collapsible.Panel>
|
|
130
|
-
<ContentArea
|
|
131
|
-
isLoading={isLoading}
|
|
132
|
-
contentProps={contentProps}
|
|
133
|
-
flushLayout={flushLayout}
|
|
134
|
-
hasFooter={hasFooter}
|
|
135
|
-
>
|
|
136
|
-
{children}
|
|
137
|
-
</ContentArea>
|
|
138
|
-
{hasFooter && (
|
|
139
|
-
<ContentFooter
|
|
140
|
-
footerContent={footerContent}
|
|
141
|
-
footerActions={footerActions}
|
|
142
|
-
/>
|
|
143
|
-
)}
|
|
144
|
-
</Collapsible.Panel>
|
|
145
|
-
</Container>
|
|
146
|
-
</Collapsible>
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const ContentBlock = ({ isCollapsible, ...props }: ContentBlockProps) => {
|
|
151
|
-
if (isCollapsible) {
|
|
152
|
-
return <CollapsibleContentBlock {...props} />;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const {
|
|
156
|
-
title,
|
|
157
|
-
subtitle,
|
|
158
|
-
titleAs = "h2",
|
|
159
|
-
subtitleAs = "h3",
|
|
160
|
-
children,
|
|
161
|
-
isLoading,
|
|
162
|
-
headerActions,
|
|
163
|
-
contentProps,
|
|
164
|
-
flushLayout,
|
|
165
|
-
footerContent,
|
|
166
|
-
footerActions,
|
|
167
|
-
} = props;
|
|
168
|
-
|
|
169
|
-
const hasFooter = !!(footerContent || footerActions);
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<Container as="section">
|
|
173
|
-
<ContentHeader
|
|
174
|
-
title={title}
|
|
175
|
-
subtitle={subtitle}
|
|
176
|
-
headingLevel={titleAs}
|
|
177
|
-
subtitleAs={subtitleAs}
|
|
178
|
-
headerActions={headerActions}
|
|
179
|
-
/>
|
|
180
|
-
<ContentArea
|
|
181
|
-
isLoading={isLoading}
|
|
182
|
-
contentProps={contentProps}
|
|
183
|
-
flushLayout={flushLayout}
|
|
184
|
-
hasFooter={hasFooter}
|
|
185
|
-
>
|
|
186
|
-
{children}
|
|
187
|
-
</ContentArea>
|
|
188
|
-
{hasFooter && (
|
|
189
|
-
<ContentFooter
|
|
190
|
-
footerContent={footerContent}
|
|
191
|
-
footerActions={footerActions}
|
|
192
|
-
/>
|
|
193
|
-
)}
|
|
194
|
-
</Container>
|
|
195
|
-
);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export default ContentBlock;
|