Skip to content

Commit a6349a2

Browse files
committed
Content: Replace with data attribute grid system
Add .content class to handle overall content reflow Use scaling fonts Refactor call outs to use grid utilities TODO: Standard mobile sizes horz scroll on some pages TODO: Homepage update to use grid utility TODO: List card layout update to use grid utility
1 parent 9db8c04 commit a6349a2

File tree

5 files changed

+119
-110
lines changed

5 files changed

+119
-110
lines changed

assets/css/v2/style.css

Lines changed: 97 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,26 @@ textarea:not([rows]) {
206206

207207
--flow-gap: 1rem;
208208

209-
/* @link https://utopia.fyi/type/calculator?c=320,16,1.2,1240,18,1.25,5,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
209+
/* @link https://utopia.fyi/type/calculator?c=320,14,1.2,1240,16,1.25,5,3,&s=0.75,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
210210
/* ALWAYS use for fonts */
211-
--font-step--3: clamp(0.576rem, 0.5796rem + -0.0047vw, 0.5787rem);
212-
--font-step--2: clamp(0.6944rem, 0.6856rem + 0.0444vw, 0.72rem);
213-
--font-step--1: clamp(0.8333rem, 0.8101rem + 0.1159vw, 0.9rem);
214-
--font-step-0: clamp(1rem, 0.9565rem + 0.2174vw, 1.125rem);
215-
--font-step-1: clamp(1.2rem, 1.1283rem + 0.3587vw, 1.4063rem);
216-
--font-step-2: clamp(1.44rem, 1.3295rem + 0.5527vw, 1.7578rem);
217-
--font-step-3: clamp(1.728rem, 1.5648rem + 0.8161vw, 2.1973rem);
218-
--font-step-4: clamp(2.0736rem, 1.8395rem + 1.1704vw, 2.7466rem);
219-
--font-step-5: clamp(2.4883rem, 2.1597rem + 1.6433vw, 3.4332rem);
211+
/* Step -3: 8.1019px → 8.192px */
212+
--font-step--3: clamp(0.5064rem, 0.5044rem + 0.0098vw, 0.512rem);
213+
/* Step -2: 9.7222px → 10.24px */
214+
--font-step--2: clamp(0.6076rem, 0.5964rem + 0.0563vw, 0.64rem);
215+
/* Step -1: 11.6667px → 12.8px */
216+
--font-step--1: clamp(0.7292rem, 0.7045rem + 0.1232vw, 0.8rem);
217+
/* Step 0: 14px → 16px */
218+
--font-step-0: clamp(0.875rem, 0.8315rem + 0.2174vw, 1rem);
219+
/* Step 1: 16.8px → 20px */
220+
--font-step-1: clamp(1.05rem, 0.9804rem + 0.3478vw, 1.25rem);
221+
/* Step 2: 20.16px → 25px */
222+
--font-step-2: clamp(1.26rem, 1.1548rem + 0.5261vw, 1.5625rem);
223+
/* Step 3: 24.192px → 31.25px */
224+
--font-step-3: clamp(1.512rem, 1.3586rem + 0.7672vw, 1.9531rem);
225+
/* Step 4: 29.0304px → 39.0625px */
226+
--font-step-4: clamp(1.8144rem, 1.5963rem + 1.0904vw, 2.4414rem);
227+
/* Step 5: 34.8365px → 48.8281px */
228+
--font-step-5: clamp(2.1773rem, 1.8731rem + 1.5208vw, 3.0518rem);
220229

221230
/* @link https://utopia.fyi/space/calculator?c=320,16,1.2,1240,18,1.25,5,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
222231
/* ALWAYS use for horizontal spacing */
@@ -515,19 +524,6 @@ ol li:last-child {
515524
}
516525
}
517526

518-
.content {
519-
grid-area: content;
520-
justify-self: center;
521-
padding: 0 var(--space-l) 2rem var(--space-l);
522-
max-width: var(--content-max-width);
523-
524-
/* Allow redocly to fill the entire container */
525-
&.content__redocly {
526-
justify-self: unset;
527-
max-width: unset;
528-
}
529-
}
530-
531527
.footer {
532528
grid-area: footer;
533529
padding: var(--space-l);
@@ -848,11 +844,75 @@ nav {
848844
/* MARK: Main content
849845
*/
850846

851-
.content-layout {
852-
display: grid;
853-
grid-template-columns: 1fr 1fr;
854-
grid-template-rows: 1fr;
855-
z-index: 1;
847+
.content {
848+
grid-area: content;
849+
justify-self: center;
850+
padding: 0 var(--space-l) 2rem var(--space-l);
851+
max-width: var(--content-max-width);
852+
853+
& > *,
854+
& > ul,
855+
& > ol {
856+
display: grid;
857+
grid-template-columns: 1fr;
858+
/* These gaps determine the spacing between all content. Be careful!! */
859+
gap: var(--space-m) var(--space-m);
860+
861+
/* Handles some strangeness where single-line codeblocks caused
862+
horizon */
863+
ol:has(.highlight-v2),
864+
ul:has(.highlight-v2) {
865+
min-width: 0;
866+
max-width: 100%;
867+
}
868+
869+
> *:not([data-grid]),
870+
> li:not([data-grid]) {
871+
grid-column: 1;
872+
}
873+
874+
[data-grid="wide"] {
875+
grid-column: 1;
876+
}
877+
[data-grid="first-third"] {
878+
grid-column: 1;
879+
}
880+
[data-grid="last-third"] {
881+
grid-column: 1;
882+
}
883+
884+
@media (min-width: 55rem) {
885+
max-width: var(--content-max-width);
886+
grid-template-columns: repeat(var(--grid-columns), 1fr);
887+
888+
> *:not([data-grid]),
889+
> li:not([data-grid]) {
890+
grid-column: 1 / 8;
891+
}
892+
893+
[data-grid="wide"] {
894+
grid-column: 1 / -1;
895+
}
896+
897+
[data-grid="first-third"] {
898+
grid-column: 1 / 4;
899+
}
900+
901+
[data-grid="first-two-thirds"] {
902+
grid-column: 1 / 8;
903+
}
904+
905+
[data-grid="last-third"] {
906+
grid-column: 8 / -1;
907+
}
908+
}
909+
}
910+
911+
/* Allow redocly to fill the entire container */
912+
&.content__redocly {
913+
justify-self: unset;
914+
max-width: unset;
915+
}
856916
}
857917

858918
#searchbox {
@@ -862,30 +922,7 @@ nav {
862922
}
863923

864924
.breadcrumb-layout {
865-
grid-column: 1 / -1;
866-
}
867-
868-
.text-content {
869-
grid-column: 1 / -1;
870-
display: grid;
871-
grid-template-columns: var(--grid-content-mobile);
872-
column-gap: var(--grid-column-gutter);
873-
margin-top: 2rem;
874-
grid-auto-rows: max-content;
875-
row-gap: var(--flow-gap);
876-
justify-content: center;
877-
}
878-
879-
.text-content > :not(.wide) {
880-
grid-column: 1 / -1;
881-
}
882-
883-
.text-content .wide {
884-
grid-column: 1 / -1;
885-
}
886-
887-
.text-content table {
888-
width: 100%;
925+
padding-top: 1rem;
889926
}
890927

891928
main {
@@ -897,29 +934,6 @@ main {
897934
display: unset;
898935
}
899936

900-
.text-content {
901-
grid-template-columns: var(--grid-content) var(--grid-side-callout);
902-
grid-template-rows: 3rem max-content;
903-
column-gap: var(--grid-column-gutter);
904-
}
905-
906-
.text-content > :not(.wide) {
907-
grid-column: 1;
908-
}
909-
910-
.content-layout {
911-
display: grid;
912-
grid-template-columns: 1fr minmax(
913-
auto,
914-
calc(
915-
var(--grid-content) +
916-
var(--grid-side-callout) +
917-
var(--grid-column-gutter)
918-
)
919-
) 1fr;
920-
column-gap: var(--grid-column-gutter);
921-
}
922-
923937
.navbar atomic-search-interface {
924938
margin: 0;
925939
display: block;
@@ -1353,14 +1367,18 @@ a:hover {
13531367
text-decoration-color: oklch(var(--color-brand) / 0.8);
13541368
}
13551369

1370+
/* MARK: Typography */
1371+
13561372
h1 {
1357-
font-size: 2rem;
1358-
margin: 0 0 1rem 0;
1373+
font-size: var(--font-step-3);
13591374
}
13601375

13611376
h2 {
1362-
font-size: 1.5rem;
1363-
margin: 1rem 0 0.75rem 0;
1377+
font-size: var(--font-step-2);
1378+
}
1379+
1380+
p {
1381+
font-size: var(--font-step-0);
13641382
}
13651383

13661384
h2:target,
@@ -1637,7 +1655,6 @@ blockquote p:last-child {
16371655
/* Maintain the split column for as long as possible */
16381656
@media (min-width: 67rem) {
16391657
blockquote.side-callout {
1640-
grid-column: 2 !important;
16411658
align-self: start;
16421659
}
16431660
}

exampleSite/content/test-product/call-out/all-callouts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ This is a plain callout with a default title for its type. It has a [link](#plai
2525

2626
Naturally, callouts should contain less text within them than the text it lives next to. We do this for several reasons. Firstly, it looks weird to have a big empty space in the primary content area. Secondly, if you have more text in the callout, then it stops being a callout. I have asked an LLM to lengthen this passage.
2727

28-
{{<call-out "side-callout">}}
28+
{{<call-out sideline="true">}}
2929
This is a plain side callout with no title. It has a [link](#plain-callouts) to a heading on this page. Its shortcode is `<call-out>` with the `.side-callout` class.
3030
{{</call-out>}}
3131

3232
When designing effective web layouts, it's important to maintain proper balance between primary content and supplementary elements. Callouts serve as attention-grabbing devices that highlight key information, but they should remain subordinate to the main content flow. This hierarchy helps users navigate your page intuitively, guiding their attention appropriately. A well-designed callout complements the surrounding text rather than competing with it.
3333

3434
Additionally, concise callouts tend to be more effective at capturing user attention. When a callout becomes too verbose, users are less likely to read it entirely, defeating its purpose. The visual weight of callouts should align with their informational importance - brief, impactful statements create better engagement than lengthy explanations. Remember that white space itself is a powerful design element, creating visual breathing room that enhances readability and focus. Ultimately, the most successful callouts follow the principle of "less is more," delivering maximum impact through minimal interruption to the user's reading experience.
3535

36-
{{<call-out "side-callout" "Custom title">}}
36+
{{<call-out sideline="true" title="Custom title">}}
3737
This is a plain side callout with a custom title. It has a [link](#plain-callouts) to a heading on this page. Its shortcode is `<call-out>` with the `.side-callout` class, and a custom title.
3838
{{</call-out>}}
3939

@@ -84,4 +84,4 @@ This is `<before-you-begin>`.
8484

8585
{{<see-also>}}
8686
This is `<see-also>`.
87-
{{</see-also>}}
87+
{{</see-also>}}

layouts/_default/list.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{{ define "main" }}
22

33
<main class="content " role="main">
4-
<section class="main-layout">
5-
<section id="maincontent" class="content-layout">
64
<div data-cms-edit="content" class="text-content list-page">
7-
<section class="breadcrumb-layout wide">
5+
<div class="breadcrumb-layout wide">
86
{{ if not .IsHome }}
97
{{ if not (in .Params.display_breadcrumb "false" ) }}
108
{{ partial "breadcrumb" .}}
119
{{ end }}
1210
{{ end }}
13-
</section>
11+
</div>
1412
<div class="list-header-container">
1513
<img src="/images/icons/{{ .Params.logo | default "NGINX-product-icon.svg" }}">
1614
<div class="list-header-title">
@@ -42,8 +40,7 @@ <h2>
4240
{{ end }}
4341

4442
</div>
45-
</section>
46-
</section>
43+
4744
</main>
4845

4946

layouts/_default/single.html

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
{{ define "main" }}
2-
32
<main class="content">
43
<!-- Replace icons -->
54
{{ $content := partial "icon-replacement.html" (dict "content" .Content) }}
65

7-
8-
<section class="main-layout">
9-
<section id="maincontent" class="content-layout">
10-
<div data-cms-edit="content" class="text-content">
11-
<section class="breadcrumb-layout wide">
12-
{{ if not .IsHome }}
13-
{{ if not (in .Params.display_breadcrumb "false" ) }}
14-
{{ partial "breadcrumb" .}}
15-
{{ end }}
16-
{{ end }}
17-
</section>
6+
<div class="breadcrumb-layout wide">
7+
{{ if not .IsHome }}
8+
{{ if not (in .Params.display_breadcrumb "false" ) }}
9+
{{ partial "breadcrumb" .}}
10+
{{ end }}
11+
{{ end }}
12+
</div>
13+
<article data-cms-edit="content" >
1814
{{ partial "banner" .}}
15+
1916
<h1>{{ .Title }}</h1>
17+
2018
{{ $content | safeHTML }}
19+
2120
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
2221
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}
2322

24-
<hr>
25-
2623
{{ if .Page.Lastmod }}
2724
<div class="last-modified">
2825
{{ partial "page-meta-links" . }}
@@ -46,6 +43,4 @@ <h1>{{ .Title }}</h1>
4643

4744

4845

49-
50-
5146
{{ end }}

layouts/partials/callout.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
{{ $sideOption := "side-callout" }}
1414
{{ $inlineOption := "inline-callout" }}
1515

16+
{{/* Default to inline callout */}}
17+
{{ $dataGrid := "first-two-thirds" }}
1618
{{ if $sideline }}
17-
{{ $class = printf "%s %s" $class $sideOption }}
18-
{{ else }}
19-
{{ $class = printf "%s %s" $class $inlineOption }}
19+
{{ $dataGrid = "last-third" }}
2020
{{ end }}
2121

2222
{{/* Render a different block, if "loud" callouts are used */}}
@@ -33,7 +33,7 @@
3333
{{ $isSpecialTitle := in $specialTitles $type }}
3434
{{ if $isSpecialTitle }}
3535
{{/* Loud callouts */}}
36-
<blockquote class="{{ $class }}">
36+
<blockquote class="{{ $class }}" data-grid="{{ $dataGrid }}">
3737
<div>
3838
<div class="call-out-type">
3939
{{ partial "feather" (dict "context" . "icon" $icon) .}}
@@ -51,7 +51,7 @@
5151

5252
{{ $cleanTitle := strings.TrimSuffix ":" $title}}
5353

54-
<blockquote class="{{ $class }} note" data-title="{{ $cleanTitle }}">
54+
<blockquote class="{{ $class }} note" data-title="{{ $cleanTitle }}" data-grid="{{ $dataGrid }}">
5555
<div class="callout-content">
5656
{{- with $icon -}}
5757
<i class="{{ . }}"></i>

0 commit comments

Comments
 (0)