Skip to content

Commit 79a71ed

Browse files
committed
Layouts: Move shared layout components to base of
1 parent 696e9c0 commit 79a71ed

File tree

5 files changed

+109
-177
lines changed

5 files changed

+109
-177
lines changed

assets/css/v2/style.css

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ ol li:last-child {
395395
.content {
396396
grid-area: content;
397397
justify-self: center;
398-
padding: 0 var(--space-l);
398+
padding: 0 var(--space-l) 2rem var(--space-l);
399399
max-width: var(--content-max-width);
400400

401401
/* Allow redocly to fill the entire container */
@@ -542,12 +542,16 @@ nav {
542542
/* MARK: Homepage
543543
*/
544544

545-
.grid-container.homepage {
545+
.grid-container:has(.homepage) {
546546
grid-template-columns: 1fr;
547547
grid-template-areas:
548548
"header"
549549
"content"
550550
"footer";
551+
552+
.sidebar {
553+
display: none;
554+
}
551555
}
552556

553557
.homepage {
@@ -652,28 +656,6 @@ nav {
652656
min-width: 100%;
653657
}
654658

655-
.sidebar-layout {
656-
display: flex;
657-
flex-direction: column;
658-
position: relative;
659-
z-index: 2;
660-
min-height: 74vh;
661-
662-
.sidebar__mobile__toggle {
663-
display: none;
664-
}
665-
}
666-
667-
.sidebar-layout::before {
668-
content: "";
669-
position: absolute;
670-
top: 0;
671-
bottom: 0;
672-
right: 0;
673-
width: 1px;
674-
background-color: oklch(var(--color-divider));
675-
}
676-
677659
#searchbox {
678660
width: 24rem;
679661
display: none;
@@ -684,11 +666,6 @@ nav {
684666
grid-column: 1 / -1;
685667
}
686668

687-
.sidebar-container {
688-
display: flex;
689-
flex-direction: column;
690-
}
691-
692669
.text-content {
693670
grid-column: 1 / -1;
694671
display: grid;
@@ -713,12 +690,6 @@ nav {
713690
}
714691

715692
@media (max-width: 88rem) {
716-
.base-layout {
717-
display: grid;
718-
grid-template-rows: repeat(2, auto);
719-
column-gap: var(--grid-column-gutter);
720-
}
721-
722693
.content-layout .breadcrumb-layout {
723694
position: sticky;
724695
top: 0;
@@ -805,14 +776,6 @@ nav {
805776
}
806777

807778
@media (min-width: 88em) {
808-
.base-layout {
809-
--grid-column-gutter: 4.5rem;
810-
display: grid;
811-
grid-template-rows: repeat(2, auto);
812-
column-gap: var(--grid-column-gutter);
813-
max-width: 100%;
814-
}
815-
816779
.text-content {
817780
grid-template-columns: var(--grid-content) var(--grid-side-callout);
818781
grid-template-rows: 70px max-content;

layouts/_default/baseof.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,24 @@
4141
{{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }}
4242
{{ partial "universal-tag.html" . }}
4343
{{ end }}
44+
<div class="grid-container">
45+
<aside class="sidebar">
46+
{{ partial "sidebar-v2.html" . }}
47+
</aside>
48+
49+
<header class="header">
50+
{{ block "header" . }}{{end}}
51+
</header>
52+
53+
{{ block "main" . }}{{ end }}
54+
55+
<footer class="footer">
56+
{{ block "footer-v2" . }}
57+
{{ partial "footer-v2.html" . }}
58+
{{ end }}
59+
</footer>
60+
</div>
4461

45-
{{ block "main" . }}{{ end }}
4662

4763
{{ partial "scripts.html" . }}
4864
<div id="consent_blackbar"></div>

layouts/_default/list.html

Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,46 @@
11
{{ define "main" }}
2-
<div class="grid-container">
3-
<aside class="sidebar">
4-
{{ partial "sidebar-v2.html" . }}
5-
</aside>
62

7-
<header class="header">
8-
{{ block "header" . }}{{end}}
9-
</header>
3+
<main class="content content-has-toc" role="main">
4+
<section class="main-layout">
105

11-
12-
<main class="content content-has-toc" role="main">
13-
<section class="main-layout">
14-
15-
<section id="maincontent" class="content-layout">
16-
<div data-cms-edit="content" class="text-content list-page">
17-
<section class="breadcrumb-layout wide">
18-
{{ if not .IsHome }}
19-
{{ if not (in .Params.display_breadcrumb "false" ) }}
20-
{{ partial "breadcrumb" .}}
21-
{{ end }}
22-
{{ end }}
23-
</section>
24-
<h1>{{ .Title }}</h1>
25-
26-
{{ partial "banner" . }}
27-
28-
{{ $hasCustomContent := .Params.hasCustomContent | default false }}
29-
{{ if $hasCustomContent }}
30-
{{ .Page.Scratch.Set "custom-landing-page-file-name" "custom-landing-page.html" }}
31-
{{ .Page.Scratch.Set "custom-landing-page-context" . }}
32-
{{ .Content }}
33-
{{ else }}
34-
{{ .Content }}
35-
{{ range .Pages.ByWeight }}
36-
<h2>
37-
<a href="{{ if .Params.url}}{{ .Params.url}}{{else}}{{ .Permalink }}{{end}}">{{ .Title }}</a>
38-
</h2>
6+
<section id="maincontent" class="content-layout">
7+
<div data-cms-edit="content" class="text-content list-page">
8+
<section class="breadcrumb-layout wide">
9+
{{ if not .IsHome }}
10+
{{ if not (in .Params.display_breadcrumb "false" ) }}
11+
{{ partial "breadcrumb" .}}
3912
{{ end }}
40-
{{ end }}
41-
42-
<hr>
43-
{{ if .Page.Lastmod }}
44-
<div class="last-modified">
45-
{{ partial "page-meta-links" . }}
46-
</div>
47-
{{ end }}
48-
13+
{{ end }}
14+
</section>
15+
<h1>{{ .Title }}</h1>
16+
17+
{{ partial "banner" . }}
18+
19+
{{ $hasCustomContent := .Params.hasCustomContent | default false }}
20+
{{ if $hasCustomContent }}
21+
{{ .Page.Scratch.Set "custom-landing-page-file-name" "custom-landing-page.html" }}
22+
{{ .Page.Scratch.Set "custom-landing-page-context" . }}
23+
{{ .Content }}
24+
{{ else }}
25+
{{ .Content }}
26+
{{ range .Pages.ByWeight }}
27+
<h2>
28+
<a href="{{ if .Params.url}}{{ .Params.url}}{{else}}{{ .Permalink }}{{end}}">{{ .Title }}</a>
29+
</h2>
30+
{{ end }}
31+
{{ end }}
32+
33+
<hr>
34+
{{ if .Page.Lastmod }}
35+
<div class="last-modified">
36+
{{ partial "page-meta-links" . }}
4937
</div>
50-
</section>
51-
</section>
52-
</main>
53-
54-
<footer class="footer">
55-
{{ block "footer-v2" . }}
56-
{{ partial "footer-v2.html" . }}
57-
{{ end }}
58-
</footer>
38+
{{ end }}
5939

40+
</div>
41+
</section>
42+
</section>
43+
</main>
6044
</div>
6145

6246
{{ end }}

layouts/_default/single.html

Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,53 @@
11
{{ define "main" }}
2-
<div class="grid-container">
3-
<aside class="sidebar">
4-
{{ partial "sidebar-v2.html" . }}
5-
</aside>
62

7-
<header class="header">
8-
{{ block "header" . }}{{end}}
9-
</header>
10-
11-
12-
<main class="content">
13-
<!-- Replace icons -->
14-
{{ $content := partial "icon-replacement.html" (dict "content" .Content) }}
15-
<main role="main">
3+
<main class="content">
4+
<!-- Replace icons -->
5+
{{ $content := partial "icon-replacement.html" (dict "content" .Content) }}
6+
<main role="main">
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>
18+
{{ partial "banner" .}}
19+
<h1>{{ .Title }}</h1>
20+
{{ $content | safeHTML }}
21+
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
22+
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}
23+
24+
<hr>
25+
26+
{{ if .Page.Lastmod }}
27+
<div class="last-modified">
28+
{{ partial "page-meta-links" . }}
29+
</div>
30+
{{ end }}
1631

17-
<section class="main-layout">
18-
<section id="maincontent" class="content-layout">
19-
<div data-cms-edit="content" class="text-content">
20-
<section class="breadcrumb-layout wide">
21-
{{ if not .IsHome }}
22-
{{ if not (in .Params.display_breadcrumb "false" ) }}
23-
{{ partial "breadcrumb" .}}
24-
{{ end }}
25-
{{ end }}
26-
</section>
27-
{{ partial "banner" .}}
28-
<h1>{{ .Title }}</h1>
29-
{{ $content | safeHTML }}
30-
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
31-
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}
32+
{{ partial "version-list" . }}
33+
{{ partial "qualtrics-feedback.html" }}
3234

33-
<hr>
35+
{{ partial "previous-next-links-in-section-with-title.html" . }}
3436

35-
{{ if .Page.Lastmod }}
36-
<div class="last-modified">
37-
{{ partial "page-meta-links" . }}
38-
</div>
39-
{{ end }}
37+
</main>
38+
</section>
39+
</section>
40+
</main>
4041

41-
{{ partial "version-list" . }}
42-
{{ partial "qualtrics-feedback.html" }}
4342

44-
{{ partial "previous-next-links-in-section-with-title.html" . }}
45-
46-
</main>
47-
</section>
48-
</section>
49-
</main>
5043

51-
<footer class="footer">
52-
{{ block "footer-v2" . }}
53-
{{ partial "footer-v2.html" . }}
54-
{{ end }}
55-
</footer>
44+
<!-- If there is a script defined in the page metadata, load it -->
45+
{{if .Params.script}}
46+
{{ $script := (delimit (slice "scripts" .Params.script) "/")}}
47+
{{ partial (string $script) .}}
48+
{{end }}
5649

57-
<!-- If there is a script defined in the page metadata, load it -->
58-
{{if .Params.script}}
59-
{{ $script := (delimit (slice "scripts" .Params.script) "/")}}
60-
{{ partial (string $script) .}}
61-
{{end }}
6250

63-
</div>
6451

6552

6653

layouts/redoc/single.html

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

3-
4-
<div class="grid-container">
5-
<aside class="sidebar">
6-
{{ partial "sidebar-v2.html" . }}
7-
</aside>
8-
9-
<header class="header">
10-
{{ block "header" . }}{{end}}
11-
</header>
12-
13-
14-
<main class="content content__redocly">
15-
16-
<div id="api-component">{{ .Content}}</div>
17-
</main>
18-
19-
<footer class="footer">
20-
{{ block "footer-v2" . }}
21-
{{ partial "footer-v2.html" . }}
22-
{{ end }}
23-
</footer>
24-
25-
<!-- If there is a script defined in the page metadata, load it -->
26-
{{if .Params.script}}
27-
{{ $script := (delimit (slice "scripts" .Params.script) "/")}}
28-
{{ partial (string $script) .}}
29-
{{end }}
3+
<main class="content content__redocly">
4+
<div id="api-component">{{ .Content}}</div>
5+
</main>
6+
7+
<!-- If there is a script defined in the page metadata, load it -->
8+
{{if .Params.script}}
9+
{{ $script := (delimit (slice "scripts" .Params.script) "/")}}
10+
{{ partial (string $script) .}}
11+
{{end }}
3012

3113
</div>
3214
{{ end }}

0 commit comments

Comments
 (0)