Skip to content

Commit 8c2beaa

Browse files
colebemisPrinceSumberia
authored andcommitted
PageLayout: Update divider prop responsive API (primer#2198)
* Deprecate dividerWhenNarrow in favor of responsive values * Update PageLayout docs * Create spotty-parents-cheat.md * Update spotty-parents-cheat.md * Update snapshots
1 parent 12bdb53 commit 8c2beaa

File tree

4 files changed

+220
-183
lines changed

4 files changed

+220
-183
lines changed

.changeset/spotty-parents-cheat.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
"@primer/react": minor
3+
---
4+
5+
* Updated the `divider` prop in `PageLayout.Header`, `PageLayout.Pane`, and `PageLayout.Footer` to use the new responsive prop API introduced in https://github.com/primer/react/pull/2174.
6+
* Deprecated the `dividerWhenNarrow` prop in favor of the new responsive prop API
7+
8+
**Before**
9+
10+
```
11+
divider="line"
12+
dividerWhenNarrow="filled"
13+
```
14+
15+
**After**
16+
17+
```
18+
divider={{regular: 'line', narrow: 'filled'}}
19+
```

docs/content/PageLayout.mdx

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ See [storybook](https://primer.style/react/storybook?path=/story/layout-pagelayo
4848
<PageLayout.Content>
4949
<Placeholder label="Content" height={240} />
5050
</PageLayout.Content>
51-
<PageLayout.Pane divider="line">
51+
{/* You can change the divider based on the viewport width */}
52+
<PageLayout.Pane divider={{narrow: 'line'}}>
5253
<Placeholder label="Pane" height={120} />
5354
</PageLayout.Pane>
5455
<PageLayout.Footer divider="line">
@@ -172,25 +173,39 @@ See [storybook](https://primer.style/react/storybook?path=/story/layout-pagelayo
172173
<PropsTableRow
173174
name="divider"
174175
type={`| 'none'
175-
| 'line'`}
176+
| 'line'
177+
| {
178+
narrow?:
179+
| 'none'
180+
| 'line'
181+
| 'filled'
182+
regular?:
183+
| 'none'
184+
| 'line'
185+
wide?:
186+
| 'none'
187+
| 'line'
188+
}`}
176189
defaultValue="'none'"
177190
/>
178191
<PropsTableRow
179192
name="dividerWhenNarrow"
193+
deprecated
180194
type={`| 'inherit'
181195
| 'none'
182196
| 'line'
183197
| 'filled'`}
184198
defaultValue="'inherit'"
199+
description="Use the divider prop with a responsive value instead."
185200
/>
186201
<PropsTableRow
187202
name="hidden"
188203
type={`| boolean
189204
| {
190-
narrow?: boolean
191-
regular?: boolean
192-
wide?: boolean
193-
}`}
205+
narrow?: boolean
206+
regular?: boolean
207+
wide?: boolean
208+
}`}
194209
defaultValue="false"
195210
description="Whether the header is hidden."
196211
/>
@@ -213,10 +228,10 @@ See [storybook](https://primer.style/react/storybook?path=/story/layout-pagelayo
213228
name="hidden"
214229
type={`| boolean
215230
| {
216-
narrow?: boolean
217-
regular?: boolean
218-
wide?: boolean
219-
}`}
231+
narrow?: boolean
232+
regular?: boolean
233+
wide?: boolean
234+
}`}
220235
defaultValue="false"
221236
description="Whether the content is hidden."
222237
/>
@@ -250,25 +265,39 @@ See [storybook](https://primer.style/react/storybook?path=/story/layout-pagelayo
250265
<PropsTableRow
251266
name="divider"
252267
type={`| 'none'
253-
| 'line'`}
268+
| 'line'
269+
| {
270+
narrow?:
271+
| 'none'
272+
| 'line'
273+
| 'filled'
274+
regular?:
275+
| 'none'
276+
| 'line'
277+
wide?:
278+
| 'none'
279+
| 'line'
280+
}`}
254281
defaultValue="'none'"
255282
/>
256283
<PropsTableRow
257284
name="dividerWhenNarrow"
285+
deprecated
258286
type={`| 'inherit'
259287
| 'none'
260288
| 'line'
261289
| 'filled'`}
262290
defaultValue="'inherit'"
291+
description="Use the divider prop with a responsive value instead."
263292
/>
264293
<PropsTableRow
265294
name="hidden"
266295
type={`| boolean
267296
| {
268-
narrow?: boolean
269-
regular?: boolean
270-
wide?: boolean
271-
}`}
297+
narrow?: boolean
298+
regular?: boolean
299+
wide?: boolean
300+
}`}
272301
defaultValue="false"
273302
description="Whether the pane is hidden."
274303
/>
@@ -281,25 +310,39 @@ See [storybook](https://primer.style/react/storybook?path=/story/layout-pagelayo
281310
<PropsTableRow
282311
name="divider"
283312
type={`| 'none'
284-
| 'line'`}
313+
| 'line'
314+
| {
315+
narrow?:
316+
| 'none'
317+
| 'line'
318+
| 'filled'
319+
regular?:
320+
| 'none'
321+
| 'line'
322+
wide?:
323+
| 'none'
324+
| 'line'
325+
}`}
285326
defaultValue="'none'"
286327
/>
287328
<PropsTableRow
288329
name="dividerWhenNarrow"
330+
deprecated
289331
type={`| 'inherit'
290332
| 'none'
291333
| 'line'
292334
| 'filled'`}
293335
defaultValue="'inherit'"
336+
description="Use the divider prop with a responsive value instead."
294337
/>
295338
<PropsTableRow
296339
name="hidden"
297340
type={`| boolean
298341
| {
299-
narrow?: boolean
300-
regular?: boolean
301-
wide?: boolean
302-
}`}
342+
narrow?: boolean
343+
regular?: boolean
344+
wide?: boolean
345+
}`}
303346
defaultValue="false"
304347
description="Whether the footer is hidden."
305348
/>

0 commit comments

Comments
 (0)