Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageLayout: Fix layout shift for divider=line #4215

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-elephants-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

PageLayout: Fix layout shift for divider=line
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions src/PageLayout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ type DividerProps = {

const horizontalDividerVariants = {
none: {
display: 'none',
height: 1,
backgroundColor: 'transparent',
},
line: {
display: 'block',
height: 1,
backgroundColor: 'border.default',
},
filled: {
display: 'block',
height: 8,
backgroundColor: 'canvas.inset',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -181,15 +180,14 @@ const HorizontalDivider: React.FC<React.PropsWithChildren<DividerProps>> = ({var

const verticalDividerVariants = {
none: {
display: 'none',
width: 1,
backgroundColor: 'transparent',
},
line: {
display: 'block',
width: 1,
backgroundColor: 'border.default',
},
filled: {
display: 'block',
width: 8,
backgroundColor: 'canvas.inset',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
36 changes: 24 additions & 12 deletions src/PageLayout/__snapshots__/PageLayout.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ exports[`PageLayout renders condensed layout 1`] = `
.c4 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-top: 16px;
}

Expand Down Expand Up @@ -104,7 +105,8 @@ exports[`PageLayout renders condensed layout 1`] = `
.c9 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-bottom: 16px;
}

Expand All @@ -119,7 +121,8 @@ exports[`PageLayout renders condensed layout 1`] = `
.c11 {
height: 100%;
position: relative;
display: none;
width: 1px;
background-color: transparent;
margin-right: 16px;
}

Expand Down Expand Up @@ -282,7 +285,8 @@ exports[`PageLayout renders default layout 1`] = `
.c4 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-top: 16px;
}

Expand Down Expand Up @@ -356,7 +360,8 @@ exports[`PageLayout renders default layout 1`] = `
.c9 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-bottom: 16px;
}

Expand All @@ -371,7 +376,8 @@ exports[`PageLayout renders default layout 1`] = `
.c11 {
height: 100%;
position: relative;
display: none;
width: 1px;
background-color: transparent;
margin-right: 16px;
}

Expand Down Expand Up @@ -624,7 +630,8 @@ exports[`PageLayout renders pane in different position when narrow 1`] = `
.c4 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-top: 16px;
}

Expand Down Expand Up @@ -698,7 +705,8 @@ exports[`PageLayout renders pane in different position when narrow 1`] = `
.c9 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-bottom: 16px;
}

Expand All @@ -713,7 +721,8 @@ exports[`PageLayout renders pane in different position when narrow 1`] = `
.c11 {
height: 100%;
position: relative;
display: none;
width: 1px;
background-color: transparent;
margin-right: 16px;
}

Expand Down Expand Up @@ -966,7 +975,8 @@ exports[`PageLayout renders with dividers 1`] = `
.c4 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-top: 16px;
}

Expand Down Expand Up @@ -1048,7 +1058,8 @@ exports[`PageLayout renders with dividers 1`] = `
.c10 {
height: 100%;
position: relative;
display: none;
width: 1px;
background-color: transparent;
margin-left: 16px;
}

Expand All @@ -1063,7 +1074,8 @@ exports[`PageLayout renders with dividers 1`] = `
.c12 {
margin-left: -16px;
margin-right: -16px;
display: none;
height: 1px;
background-color: transparent;
margin-bottom: 16px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ exports[`SplitPageLayout renders default layout 1`] = `
.c4 {
margin-left: 0;
margin-right: 0;
display: block;
height: 1px;
background-color: var(--borderColor-default,var(--color-border-default,#d0d7de));
margin-top: 0;
Expand Down Expand Up @@ -106,7 +105,8 @@ exports[`SplitPageLayout renders default layout 1`] = `
.c9 {
margin-left: 0;
margin-right: 0;
display: none;
height: 1px;
background-color: transparent;
margin-top: 0;
}

Expand All @@ -121,7 +121,8 @@ exports[`SplitPageLayout renders default layout 1`] = `
.c11 {
height: 100%;
position: relative;
display: none;
width: 1px;
background-color: transparent;
margin-left: 0;
}

Expand All @@ -136,7 +137,6 @@ exports[`SplitPageLayout renders default layout 1`] = `
.c13 {
margin-left: 0;
margin-right: 0;
display: block;
height: 1px;
background-color: var(--borderColor-default,var(--color-border-default,#d0d7de));
margin-bottom: 0;
Expand Down
Loading