From c2939d58ece63d14fe38aba731f4242ce8f18553 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Sat, 12 Oct 2024 22:38:41 +0100 Subject: [PATCH] Ready feature boxes on main page for vanilla Docsy --- assets/scss/_base.scss | 73 ++++++++++--------- assets/scss/_custom.scss | 8 ++ assets/scss/_tablet.scss | 34 ++------- .../blocks/kubernetes-features.html | 21 +++--- 4 files changed, 62 insertions(+), 74 deletions(-) diff --git a/assets/scss/_base.scss b/assets/scss/_base.scss index b05c6a1c8e..d8de9f9d89 100644 --- a/assets/scss/_base.scss +++ b/assets/scss/_base.scss @@ -437,12 +437,6 @@ $ocean-nodes-h3-margin-bottom: 30px; // video $video-section-height: 200px; -// features -$features-h3-margin-bottom: 20px; -$feature-box-div-width: 100%; -$feature-box-margin-bottom: 0; -$feature-box-div-margin-bottom: 40px; - // Home-specific .td-home { @@ -687,47 +681,58 @@ section#cncf { } // Features -#features { - padding-top: 140px; +body.td-home section.features-container { + padding: 0; // reset + padding-top: 140px; // make room for logo + background-color: $light-grey; background-image: url(/images/wheel.svg); background-position: center 60px; background-repeat: no-repeat; background-size: 60px; -} -.feature-box { - //padding: 50px 0 - width: 100%; - overflow: hidden; - clear: both; - display: flex; - justify-content: space-evenly; - flex-wrap: wrap; + padding-bottom: 2em; - h4 { - line-height: normal; - margin-bottom: 15px; + .k8s-features-heading { + color: $primary; + text-align: center; } & > div { - background-color: #daeaf9; - border-radius: 20px; - padding: 25px; - } -} + display: flex; + flex-direction: row; + justify-content: center; + flex-wrap: wrap; + align-content: flex-start; + align-items: stretch; + gap: 1.2rem; -#features { - h3 { - margin-bottom: $features-h3-margin-bottom; - } + margin-top: 1.8em; - .feature-box { - margin-bottom: $feature-box-margin-bottom; + max-width: clamp(75em, 25cm, 90vw); + margin-left: auto; + margin-right: auto; - & > div { - width: $feature-box-div-width; - margin-bottom: $feature-box-div-margin-bottom; + background: initial; + + & > .feature-box { + margin: 0; + + h3 { + text-align: center; + line-height: normal; + font-size: 1.3em; + margin-bottom: 1rem; + } + + flex-basis: calc(min(75vw, 12.5cm, 35em)); + flex-shrink: 0; + + border-radius: 0.5em; + padding: 1em; + padding-bottom: 1.2em; + + background-color: #daeaf9; // light blue } } } diff --git a/assets/scss/_custom.scss b/assets/scss/_custom.scss index a87c4bb121..a73eae7ac0 100644 --- a/assets/scss/_custom.scss +++ b/assets/scss/_custom.scss @@ -1233,6 +1233,14 @@ body.td-search #search { padding: 0.2rem; } + +// handle main page features on narrow viewports +@media screen and (max-width: 768px) { + .features-container div.feature-box { + min-width: 80vw; + } +} + @media screen and (max-aspect-ratio: 9/15) { gap: 0.4rem; } diff --git a/assets/scss/_tablet.scss b/assets/scss/_tablet.scss index ca245bca2c..69385b022b 100644 --- a/assets/scss/_tablet.scss +++ b/assets/scss/_tablet.scss @@ -31,12 +31,6 @@ $vendor-strip-font-size: 16px; //video $video-section-height: 400px; -//features -$features-h3-margin-bottom: 40px; -$feature-box-margin-bottom: 60px; -$feature-box-div-margin-bottom: 0; -$feature-box-div-width: 45%; - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -156,29 +150,6 @@ $feature-box-div-width: 45%; display: none; } - #features { - padding-bottom: 60px; - - .feature-box { - margin-bottom: 30px; - - &:last-child { - margin-bottom: 0; - } - } - - h3 { - margin-bottom: $features-h3-margin-bottom; - } - - .feature-box { - & > div { - width: $feature-box-div-width; - margin-bottom: $feature-box-div-margin-bottom; - } - } - } - #talkToUs { #bigSocial { div { @@ -211,4 +182,9 @@ $feature-box-div-width: 45%; width: 48%; } } + + .features-container div.feature-box { + min-width: clamp(20rem, 6cm, 90vw); + max-width: clamp(90rem, 10cm, 90vw); + } } diff --git a/layouts/shortcodes/blocks/kubernetes-features.html b/layouts/shortcodes/blocks/kubernetes-features.html index a653de6f15..c1f7428429 100644 --- a/layouts/shortcodes/blocks/kubernetes-features.html +++ b/layouts/shortcodes/blocks/kubernetes-features.html @@ -14,23 +14,22 @@ feature: Note that markdown can be used in the description. */}} -
-
-

{{ T "main_kubernetes_features" }}

+
+ {{- with resources.Get "images/wheel.svg" -}} + + {{- end -}} + +

{{ T "main_kubernetes_features" }}

+
{{ $pages := where site.Pages ".Params.feature" "!=" nil }} - {{range $i, $p := $pages }} - {{ if and (gt $i 0) (modBool $i 2) }}
{{ end }} - {{ if modBool $i 2 }} -
- {{ end }} -
+ {{ range $i, $p := $pages }} +
{{ with .Params.feature }} -

{{ .title }}

+

{{ .title }}

{{ $description := .description | default $p.Params.description }} {{ $description | markdownify }} {{ end }}
- {{ end }}