-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split normalised and enhanced system styling
- Loading branch information
Egor Kloos
committed
Jan 16, 2024
1 parent
34e9589
commit 8561da2
Showing
10 changed files
with
177 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,89 @@ | ||
@layer --system { | ||
body { | ||
--viewport-padding: minmax(var(--system-spacing-page-inline), 1fr); | ||
--content-width: minmax( | ||
calc(var(--system-dimension-min-width) - (var(--system-spacing-page-inline) * 2)), | ||
var(--system-dimension-content-width) | ||
); | ||
|
||
display: grid; | ||
grid-template-columns: | ||
[--viewport-start] var(--viewport-padding) [--content-start] var(--content-width) [--content-end] var( | ||
--viewport-padding | ||
) | ||
[--viewport-end]; | ||
} | ||
body > :is(header, footer) { | ||
display: grid; | ||
grid-template-columns: subgrid; | ||
grid-column: --viewport-start / --viewport-end; | ||
padding-block: var(--system-spacing-main); | ||
@container --system (width > 1rem) { | ||
body { | ||
--viewport-padding: minmax(var(--system-spacing-page-inline), 1fr); | ||
--content-width: minmax( | ||
calc(var(--system-dimension-min-width) - (var(--system-spacing-page-inline) * 2)), | ||
var(--system-dimension-content-width) | ||
); | ||
|
||
& > * { | ||
grid-column: --content-start / --content-end; | ||
margin: 0; | ||
padding: 0; | ||
display: grid; | ||
grid-template-columns: | ||
[--viewport-start] var(--viewport-padding) [--content-start] var(--content-width) [--content-end] var( | ||
--viewport-padding | ||
) | ||
[--viewport-end]; | ||
margin: unset; | ||
} | ||
} | ||
|
||
main { | ||
/* Center main in page */ | ||
grid-column: --content-start / --content-end; | ||
container: --content / inline-size; | ||
padding-block: clamp( | ||
var(--system-spacing-main) * 2, | ||
var(--system-spacing-page-inline), | ||
var(--system-spacing-main) * 4 | ||
); | ||
/* Waiting on margin-trim */ | ||
|
||
& > *:first-child { | ||
margin-block-start: unset; | ||
body > :is(header, footer) { | ||
display: grid; | ||
grid-template-columns: subgrid; | ||
grid-column: --viewport-start / --viewport-end; | ||
padding-block: var(--system-spacing-main); | ||
|
||
& > * { | ||
grid-column: --content-start / --content-end; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} | ||
|
||
& > *:last-child { | ||
margin-block-end: unset; | ||
body > header { | ||
background: var(--system-surface-color); | ||
|
||
& > :is(h1, h2, h3), | ||
& > p:only-child { | ||
font-weight: var(--system-font-weight-extralight); | ||
font-family: var(--system-font-family-display); | ||
font-size: var(--system-font-size-xxl); | ||
color: var(--system-gray-text); | ||
} | ||
& > nav { | ||
font-family: var(--system-font-family-interactive); | ||
& [href] { | ||
color: var(--system-link-text); | ||
} | ||
& [aria-current='page'] { | ||
pointer-events: none; | ||
text-decoration: none; | ||
color: currentcolor; | ||
} | ||
} | ||
} | ||
} | ||
|
||
body > header > nav { | ||
display: flex; | ||
column-gap: var(--system-spacing-column-gap); | ||
margin-block-start: var(--system-spacing-single); | ||
} | ||
body > :is(header, main, footer):not(:has(*)) { | ||
display: none; | ||
} | ||
|
||
body > :is(header, main, footer):not(:has(*)) { | ||
display: none; | ||
body > main { | ||
/* Center main in page */ | ||
grid-column: --content-start / --content-end; | ||
container: --content / inline-size; | ||
padding-block: clamp( | ||
var(--system-spacing-main) * 2, | ||
var(--system-spacing-page-inline), | ||
var(--system-spacing-main) * 4 | ||
); | ||
/* Waiting on margin-trim */ | ||
|
||
& > *:first-child { | ||
margin-block-start: unset; | ||
} | ||
|
||
& > *:last-child { | ||
margin-block-end: unset; | ||
} | ||
} | ||
|
||
body > header > nav { | ||
display: flex; | ||
column-gap: var(--system-spacing-column-gap); | ||
margin-block-start: var(--system-spacing-single); | ||
} | ||
|
||
body > :is(header, main, footer):not(:has(*)) { | ||
display: none; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.