Skip to content

Commit 4e797ef

Browse files
authored
Remove Box usage and sx prop from PageLayout (#6872)
1 parent 0834e9e commit 4e797ef

File tree

8 files changed

+155
-91
lines changed

8 files changed

+155
-91
lines changed

.changeset/gold-geckos-send.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
Removes sx prop from PageLayout and subcomponents
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.DebugPageLayout {
2+
/* `red` is just used for debugging purposes. VRTs fail if changed. */
3+
/* stylelint-disable-next-line color-named */
4+
border: var(--borderWidth-thin) solid red;
5+
}
6+
7+
.SuccessColor {
8+
color: var(--fgColor-success);
9+
}

packages/react/src/PageLayout/PageLayout.dev.stories.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {Meta, StoryFn} from '@storybook/react-vite'
22
import {Placeholder} from '../Placeholder'
33
import {PageLayout} from './PageLayout'
4+
import classes from './PageLayout.dev.stories.module.css'
45

56
const meta: Meta = {
67
title: 'Components/PageLayout/Dev',
@@ -346,11 +347,11 @@ export const Default: StoryFn = args => (
346347
padding={args.padding}
347348
rowGap={args.rowGap}
348349
columnGap={args.columnGap}
349-
sx={{border: '1px solid red'}}
350+
className={classes.DebugPageLayout}
350351
>
351352
<PageLayout.Header
352353
padding={args['Header.padding']}
353-
sx={{color: 'var(--fgColor-success)'}}
354+
className={classes.SuccessColor}
354355
divider={{
355356
narrow: args['Header.divider.narrow'],
356357
regular: args['Header.divider.regular'],
@@ -365,7 +366,7 @@ export const Default: StoryFn = args => (
365366
<Placeholder height={args['Header placeholder height']} label="Header" />
366367
</PageLayout.Header>
367368
<PageLayout.Content
368-
sx={{color: 'var(--fgColor-success)'}}
369+
className={classes.SuccessColor}
369370
width={args['Content.width']}
370371
padding={args['Content.padding']}
371372
hidden={{
@@ -377,7 +378,7 @@ export const Default: StoryFn = args => (
377378
<Placeholder height={args['Content placeholder height']} label="Content" />
378379
</PageLayout.Content>
379380
<PageLayout.Pane
380-
sx={{color: 'var(--fgColor-success)'}}
381+
className={classes.SuccessColor}
381382
position={{
382383
narrow: args['Pane.position.narrow'],
383384
regular: args['Pane.position.regular'],
@@ -402,7 +403,7 @@ export const Default: StoryFn = args => (
402403
<Placeholder height={args['Pane placeholder height']} label="Pane" />
403404
</PageLayout.Pane>
404405
<PageLayout.Footer
405-
sx={{color: 'var(--fgColor-success)'}}
406+
className={classes.SuccessColor}
406407
padding={args['Footer.padding']}
407408
divider={{
408409
narrow: args['Footer.divider.narrow'],

packages/react/src/PageLayout/PageLayout.module.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,23 @@ body[data-page-layout-dragging='true'] * {
325325
/* stylelint-disable-next-line primer/spacing */
326326
padding: var(--spacing);
327327
}
328+
329+
.DraggableHandle {
330+
position: absolute;
331+
inset: 0 -2px;
332+
cursor: col-resize;
333+
background-color: transparent;
334+
transition-delay: 0.1s;
335+
}
336+
337+
.DraggableHandle:hover {
338+
background-color: var(--bgColor-neutral-muted);
339+
}
340+
341+
.DraggableHandle[data-dragging='true'] {
342+
background-color: var(--bgColor-accent-emphasis);
343+
}
344+
345+
.DraggableHandle[data-dragging='true']:hover {
346+
background-color: var(--bgColor-accent-emphasis);
347+
}

packages/react/src/PageLayout/PageLayout.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ export const Default: StoryFn = args => (
349349
padding={args.padding}
350350
rowGap={args.rowGap}
351351
columnGap={args.columnGap}
352-
sx={args.sx}
353352
>
354353
{args['Render header?'] ? (
355354
<PageLayout.Header

0 commit comments

Comments
 (0)