Skip to content

Commit e7a086c

Browse files
committed
Chore: Merge branch 'mainframe' into mainframe-regrid
2 parents 3ffd1d2 + 52ca5c8 commit e7a086c

File tree

10 files changed

+159
-36
lines changed

10 files changed

+159
-36
lines changed

.github/workflows/build-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111

1212
jobs:
1313
deploy-example-site:
14-
uses: nginxinc/docs-actions/.github/workflows/docs-build-push.yml@9c59fab05a8131f4d691ba6ea2b6a119f3ef832a # v1.0.7
14+
uses: nginxinc/docs-actions/.github/workflows/docs-build-push.yml@285440f02d9967b62aeb1b7e0b5c2c70d4f950cf # v1.0.10
1515
with:
1616
production_url_path: "/nginx-hugo-theme"
1717
preview_url_path: "/previews/nginx-hugo-theme"

assets/css/v2/style.css

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,31 +1391,88 @@ h6:has(a):hover {
13911391
}
13921392

13931393
/* Landing page cards */
1394-
13951394
.text-content .card-layout {
1396-
grid-column: 1 / -1;
1395+
grid-column: 1;
13971396

13981397
.card-section {
1399-
margin-bottom: 1rem;
1398+
display: flex;
1399+
flex-direction: column;
1400+
gap: 1rem;
14001401

14011402
strong {
14021403
font-weight: 500;
14031404
}
1405+
1406+
/* Hide all the cards past 3 if it is a featured card section */
1407+
&.featured-section {
1408+
.card-section-content.card-grid > *:nth-child(n + 4) {
1409+
display: none;
1410+
}
1411+
}
14041412
}
14051413
}
14061414

14071415
/* Optional grid layout */
14081416
.card-grid {
14091417
display: grid;
1410-
grid-template-columns: repeat(auto-fit, minmax(120px, 500px));
1418+
grid-template-columns: repeat(auto-fit, minmax(33%, 1fr));
14111419
gap: 1.5rem;
1412-
margin-top: 1rem;
14131420

14141421
.card-container {
14151422
border: 1px solid oklch(var(--color-codeblock-border));
14161423
box-shadow: 3px 3px 0px oklch(var(--color-shadow));
1417-
padding: 1rem 2rem 2rem 2rem;
1418-
margin-bottom: 1.5rem;
1424+
padding: 1rem;
1425+
1426+
&.featured-card {
1427+
/* If there is a need for a featured card, only the featured card should be full length */
1428+
grid-column: 1 / -1;
1429+
1430+
/* If there is a featured card AND two cards, the last one should be full length */
1431+
~ .card-container:nth-child(2n):last-child {
1432+
grid-column: 1 / -1;
1433+
}
1434+
}
1435+
}
1436+
1437+
/* If there is no featured card, last card that is the 3rd one should be full width */
1438+
&:not(:has(.featured-card)) .card-container:nth-child(3n) {
1439+
grid-column: 1 / -1;
1440+
}
1441+
}
1442+
1443+
.card-container {
1444+
display: flex;
1445+
flex-direction: column;
1446+
gap: 0.5rem;
1447+
margin-bottom: 1rem;
1448+
1449+
.card-header {
1450+
display: flex;
1451+
flex-direction: row;
1452+
gap: 0.5rem;
1453+
1454+
.card-brand-icon {
1455+
height: 20px;
1456+
width: auto;
1457+
}
1458+
1459+
h2 {
1460+
padding: 0;
1461+
margin: 0;
1462+
font-size: 1rem;
1463+
}
1464+
}
1465+
}
1466+
1467+
.list-header-container {
1468+
display: flex;
1469+
gap: 1.5rem;
1470+
align-items: center;
1471+
justify-content: start;
1472+
1473+
img {
1474+
width: auto;
1475+
height: 3.5rem;
14191476
}
14201477
}
14211478

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
---
2-
description: Test pages for nginx-hugo-theme
2+
# The title is the product name
33
title: Test pages
44
weight: 100
5-
---
5+
# The URL is the base of the deployed path, becoming "docs.nginx.com/<url>/<other-pages>"
6+
url:
7+
# The subtitle displays directly underneath the heading of a given page
8+
nd-subtitle: Test pages for nginx-hugo-theme
9+
# Indicates that this is a custom landing page
10+
nd-landing-page: true
11+
# Types have a 1:1 relationship with Hugo archetypes, so you shouldn't need to change this
12+
nd-content-type: landing-page
13+
# Intended for internal catalogue and search, case sensitive:
14+
# Agent, N4Azure, NIC, NIM, NGF, NAP-DOS, NAP-WAF, NGINX One, NGINX+, Solutions, Unit
15+
nd-product:
16+
---
17+
18+
## About
19+
[//]: # "These are Markdown comments to guide you through document structure. Remove them as you go, as well as any unnecessary sections."
20+
[//]: # "Use underscores for _italics_, and double asterisks for **bold**."
21+
[//]: # "Backticks are for `monospace`, used sparingly and reserved mostly for executable names - they can cause formatting problems. Avoid them in tables: use italics instead."
22+
23+
[//]: # "This initial section introduces the product to a reader: give a short 1-2 sentence summary of what the product does and its value to the reader."
24+
[//]: # "Name specific functionality it provides: avoid ambiguous descriptions such as 'enables efficiency', focus on what makes it unique."
25+
26+
This is a compilation of all our shortcodes to show how they look, function, respond, and coded.
27+
28+
## Featured Content
29+
[//]: # "You can add a maximum of three cards: any extra will not display."
30+
[//]: # "One card will take full width page: two will take half width each. Three will stack like an inverse pyramid."
31+
[//]: # "Some examples of content could be the latest release note, the most common install path, and a popular new feature."
32+
33+
{{<card-layout >}}
34+
{{<card-section showAsCards="true" isFeaturedSection="true">}}
35+
{{<card title="Everything" titleUrl="everything" icon="circle-dot-dashed">}}
36+
All shortcodes in one page.
37+
{{</card >}}
38+
{{<card title="Call Out usages" titleUrl="call-out/all-callouts/" icon="message-square">}}
39+
Examples for call-out shortcode
40+
{{</card >}}
41+
{{<card title="Code Block usages" titleUrl="code-blocks/code-blocks-highlighting/" icon="code">}}
42+
Examples for codeblock shortcode
43+
{{</card >}}
44+
{{</card-section>}}
45+
{{</card-layout >}}
46+
47+
## Other Content
48+
[//]: # "You can add any extra content for the page here, such as additional cards, diagrams or text."
49+
50+
{{<card-layout >}}
51+
{{<card-section title="NGINX" showAsCards="true" >}}
52+
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon-RGB" >}}
53+
Installing NGINX
54+
{{</card >}}
55+
{{</card-section >}}
56+
{{</card-layout >}}

layouts/partials/banner.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- with .Params.banner -}}
1+
{{- with index .Params "nd-banner" -}}
22
{{- if .enabled -}}
33
<!-- Gather the dates and default to beginning or end of time if frontmatter is not provided -->
44
{{- $currentDate := now | dateFormat "2006-01-02" -}}

layouts/shortcodes/card-layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<!-- Render the main content first with modifications, then render the custom content -->
2-
<div class="card-layout">{{- .Inner | markdownify -}}</div>
2+
<div class="card-layout">{{- .Inner | markdownify -}}</div>

layouts/shortcodes/card-section.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{ $title := .Get "title" }}
2+
{{ $isFeaturedSectionParam := .Get "isFeaturedSection" | default "false" }}
23
{{ $showAsCardsParam := .Get "showAsCards" | default "false"}}
34
{{- /* Validate the parameter strictly */ -}}
45
{{- if not (in (slice "true" "false") $showAsCardsParam) -}}
@@ -8,13 +9,20 @@
89
{{- $current := .Page.Scratch.Get "showAsCards" | default (dict) -}}
910
{{- $newShowAsCards := dict ($title | default "main") ($showAsCards) -}}
1011
{{- .Page.Scratch.Set "showAsCards" (merge $current ($newShowAsCards)) -}}
11-
{{- $class := "card-grid wide" -}}
12+
{{- /* Limit the cards if it is a featured section */ -}}
13+
{{- if not (in (slice "true" "false") $isFeaturedSectionParam) -}}
14+
{{- warnf "The '<card-section>' Shortcode parameter 'isFeaturedSection' must be 'true' or 'false', but got: '%s'. This will now default to 'false'" $isFeaturedSectionParam -}}
15+
{{- end -}}
16+
{{- $isFeaturedSection := cond (eq $isFeaturedSectionParam "true") "true" "false" -}}
17+
{{- $class := "card-grid" -}}
1218
{{- /* Validate that the parent is card-layout */ -}}
1319
{{ if eq .Parent.Name "card-layout"}}
14-
<div class="card-section">
20+
<div class="card-section {{if eq $isFeaturedSection "true"}}featured-section{{ end }}">
1521
{{- if $title -}}
1622
<strong class="card-section-title">{{- $title -}}</strong>
1723
<div class="card-section-content{{ if eq $showAsCards "true" }} {{ $class }} {{ end }}">{{- .Inner -}}</div>
24+
{{ else }}
25+
<div class="card-section-content{{ if eq $showAsCards "true" }} {{ $class }} {{ end }}">{{ .Inner }}</div>
1826
{{ end }}
1927
</div>
2028
{{ else }}

layouts/shortcodes/card.html

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
{{- $title := .Get "title" -}}
22
{{- $titleUrl := .Get "titleUrl" | default "/" -}}
3-
{{- $icon := .Get "icon" | default "NGINX-product-icon" -}}
3+
{{- $icon := .Get "icon" | default "book-open" -}}
4+
{{- $brandIcon := .Get "brandIcon" -}}
5+
{{- $isFeaturedParam := .Get "isFeatured" | default "false" }}
6+
{{- /* Validate the parameter strictly */ -}}
7+
{{- if not (in (slice "true" "false") $isFeaturedParam) -}}
8+
{{- warnf "The '<card>' Shortcode parameter 'isFeatured' must be 'true' or 'false', but got: '%s'. This will now default to 'false'" $isFeaturedParam -}}
9+
{{- end -}}
10+
{{- $isFeatured := cond (eq $isFeaturedParam "true") "true" "false" -}}
411
{{- $current := .Page.Scratch.Get "cards" | default (slice) -}}
512
{{- $newCard := dict "title" ($title) "content" (.Inner) -}}
613
{{- .Page.Scratch.Set "cards" ($current | append $newCard) -}}
7-
{{- /* Validate that the parent is card-section */ -}}
8-
{{- if eq .Parent.Name "card-section" -}}
9-
<div class="card-container">
14+
{{- /* Validate that the parent is card-section and under 3 cards */ -}}
15+
{{- if (eq .Parent.Name "card-section") -}}
16+
<div class="card-container {{ if eq $isFeatured "true" }}featured-card{{ end }}">
1017
{{- if $title -}}
11-
{{- if $titleUrl -}}
12-
<h2 class="card-title"><a href="{{- $titleUrl -}}">{{- $title -}}</a></h2>
13-
{{- else -}}
14-
<h2 class="card-title">{{- $title -}}</h2>
15-
{{- end -}}
18+
<div class="card-header">
19+
{{- if $brandIcon -}}
20+
<img class="card-brand-icon" src="/images/icons/{{ $brandIcon }}.svg">
21+
{{- else -}}
22+
{{- if $icon -}}
23+
{{ partial "lucide" (dict "context" . "icon" $icon) }}
24+
{{- end -}}
25+
{{- end -}}
26+
{{- if $titleUrl -}}
27+
<h2 class="card-title"><a href="{{- $titleUrl -}}">{{- $title -}}</a></h2>
28+
{{- else -}}
29+
<h2 class="card-title">{{- $title -}}</h2>
30+
{{- end -}}
31+
</div>
1632
{{- else -}}
1733
{{ errorf "Mainframe: Missing param 'title'" }}
1834
{{- end -}}

layouts/shortcodes/dimensions.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
{{ $jsPath := replace $rawJSPath "/static" "" }}
44
{{ $dimensionsRef := dict }}
55
{{ with resources.Get $jsPath }}
6-
{{ with .Err }}
7-
{{ errorf "%s" . }}
8-
{{ else }}
96
{{ $dimensionsRef = . | transform.Unmarshal }}
10-
{{ end }}
117
{{ else }}
12-
{{ errorf "Unable to get asset resource %q" $jsPath }}
8+
{{ errorf "Unable to get asset resource %q" $jsPath }}
139
{{ end }}
1410

15-
1611
<div class="row flex-xl-nowrap">
1712

1813

layouts/shortcodes/ghcode.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ $file := .Get 0 }}
22
{{ $params := .Get 1 }}
33
{{ $codeBlockId := printf "id-%x" (now.UnixNano) }}
4-
{{ with resources.GetRemote $file }}
4+
{{ with try (resources.GetRemote $file) }}
55
{{ with .Err }}
66
{{ errorf "%s" . }}
77
{{ else }}
@@ -13,10 +13,10 @@
1313
<div class="code-container chroma">
1414
<button onclick="copyToClipBoard(this, {{ $codeBlockId }})" class="code-copy-button multi-line" type="button">Copy</button>
1515
<div class="highlight-v2" id="{{ $codeBlockId }}">
16-
{{ highlight .Content $lang $params }}
16+
{{ highlight .Value $lang $params }}
1717
</div>
1818
</div>
19-
</div>
19+
</div>
2020
{{ end }}
2121
{{ else }}
2222
{{ errorf "Unable to load github content from %s from %q" $file .Position}}

layouts/shortcodes/metrics.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
{{ $jsPath := replace $rawJSPath "/static" "" }}
44
{{ $metricsRef := dict }}
55
{{ with resources.Get $jsPath }}
6-
{{ with .Err }}
7-
{{ errorf "%s" . }}
8-
{{ else }}
96
{{ $metricsRef = . | transform.Unmarshal }}
10-
{{ end }}
117
{{ else }}
128
{{ errorf "Unable to get asset resource %q" $jsPath }}
139
{{ end }}

0 commit comments

Comments
 (0)