Skip to content

Commit d08a2f4

Browse files
authored
Merge pull request #48308 from sftim/20241012_main_page_feature_boxes
Restyle feature boxes on main page and ready for vanilla Docsy
2 parents cc0465d + c2939d5 commit d08a2f4

File tree

4 files changed

+62
-74
lines changed

4 files changed

+62
-74
lines changed

assets/scss/_base.scss

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,6 @@ $ocean-nodes-h3-margin-bottom: 30px;
437437
// video
438438
$video-section-height: 200px;
439439

440-
// features
441-
$features-h3-margin-bottom: 20px;
442-
$feature-box-div-width: 100%;
443-
$feature-box-margin-bottom: 0;
444-
$feature-box-div-margin-bottom: 40px;
445-
446440
// Home-specific
447441

448442
.td-home {
@@ -687,47 +681,58 @@ section#cncf {
687681
}
688682

689683
// Features
690-
#features {
691-
padding-top: 140px;
684+
body.td-home section.features-container {
685+
padding: 0; // reset
686+
padding-top: 140px; // make room for logo
687+
692688
background-color: $light-grey;
693689
background-image: url(/images/wheel.svg);
694690
background-position: center 60px;
695691
background-repeat: no-repeat;
696692
background-size: 60px;
697-
}
698693

699-
.feature-box {
700-
//padding: 50px 0
701-
width: 100%;
702-
overflow: hidden;
703-
clear: both;
704-
display: flex;
705-
justify-content: space-evenly;
706-
flex-wrap: wrap;
694+
padding-bottom: 2em;
707695

708-
h4 {
709-
line-height: normal;
710-
margin-bottom: 15px;
696+
.k8s-features-heading {
697+
color: $primary;
698+
text-align: center;
711699
}
712700

713701
& > div {
714-
background-color: #daeaf9;
715-
border-radius: 20px;
716-
padding: 25px;
717-
}
718-
}
702+
display: flex;
703+
flex-direction: row;
704+
justify-content: center;
705+
flex-wrap: wrap;
706+
align-content: flex-start;
707+
align-items: stretch;
708+
gap: 1.2rem;
719709

720-
#features {
721-
h3 {
722-
margin-bottom: $features-h3-margin-bottom;
723-
}
710+
margin-top: 1.8em;
711+
712+
max-width: clamp(75em, 25cm, 90vw);
713+
margin-left: auto;
714+
margin-right: auto;
715+
716+
background: initial;
717+
718+
& > .feature-box {
719+
margin: 0;
720+
721+
h3 {
722+
text-align: center;
723+
line-height: normal;
724+
font-size: 1.3em;
725+
margin-bottom: 1rem;
726+
}
727+
728+
flex-basis: calc(min(75vw, 12.5cm, 35em));
729+
flex-shrink: 0;
724730

725-
.feature-box {
726-
margin-bottom: $feature-box-margin-bottom;
731+
border-radius: 0.5em;
732+
padding: 1em;
733+
padding-bottom: 1.2em;
727734

728-
& > div {
729-
width: $feature-box-div-width;
730-
margin-bottom: $feature-box-div-margin-bottom;
735+
background-color: #daeaf9; // light blue
731736
}
732737
}
733738
}

assets/scss/_custom.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,14 @@ body.td-search #search {
19541954
padding: 0.2rem;
19551955
}
19561956

1957+
1958+
// handle main page features on narrow viewports
1959+
@media screen and (max-width: 768px) {
1960+
.features-container div.feature-box {
1961+
min-width: 80vw;
1962+
}
1963+
}
1964+
19571965
@media screen and (max-aspect-ratio: 9/15) {
19581966
gap: 0.4rem;
19591967
}

assets/scss/_tablet.scss

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ $vendor-strip-font-size: 16px;
3131
//video
3232
$video-section-height: 400px;
3333

34-
//features
35-
$features-h3-margin-bottom: 40px;
36-
$feature-box-margin-bottom: 60px;
37-
$feature-box-div-margin-bottom: 0;
38-
$feature-box-div-width: 45%;
39-
4034
////////////////////////////////////////////////////////////////////////////////////////////////////
4135
////////////////////////////////////////////////////////////////////////////////////////////////////
4236
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -156,29 +150,6 @@ $feature-box-div-width: 45%;
156150
display: none;
157151
}
158152

159-
#features {
160-
padding-bottom: 60px;
161-
162-
.feature-box {
163-
margin-bottom: 30px;
164-
165-
&:last-child {
166-
margin-bottom: 0;
167-
}
168-
}
169-
170-
h3 {
171-
margin-bottom: $features-h3-margin-bottom;
172-
}
173-
174-
.feature-box {
175-
& > div {
176-
width: $feature-box-div-width;
177-
margin-bottom: $feature-box-div-margin-bottom;
178-
}
179-
}
180-
}
181-
182153
#talkToUs {
183154
#bigSocial {
184155
div {
@@ -211,4 +182,9 @@ $feature-box-div-width: 45%;
211182
width: 48%;
212183
}
213184
}
185+
186+
.features-container div.feature-box {
187+
min-width: clamp(20rem, 6cm, 90vw);
188+
max-width: clamp(90rem, 10cm, 90vw);
189+
}
214190
}

layouts/shortcodes/blocks/kubernetes-features.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,22 @@
1414
Note that markdown can be used in the description.
1515

1616
*/}}
17-
<section id="features">
18-
<div class="main-section">
19-
<h3 class="center">{{ T "main_kubernetes_features" }}</h3>
17+
<section class="features-container" id="features">
18+
{{- with resources.Get "images/wheel.svg" -}}
19+
<img class="kubernetes-logo wheel" src="{{ .RelPermalink }}" alt="">
20+
{{- end -}}
21+
22+
<h2 class="k8s-features-heading">{{ T "main_kubernetes_features" }}</h2>
23+
<div>
2024
{{ $pages := where site.Pages ".Params.feature" "!=" nil }}
21-
{{range $i, $p := $pages }}
22-
{{ if and (gt $i 0) (modBool $i 2) }}</div>{{ end }}
23-
{{ if modBool $i 2 }}
24-
<div class="feature-box">
25-
{{ end }}
26-
<div>
25+
{{ range $i, $p := $pages }}
26+
<div class="feature-box">
2727
{{ with .Params.feature }}
28-
<h4><a href="{{ $p.RelPermalink}}{{ with .anchor }}#{{ . | anchorize }}{{ end }}">{{ .title }}</a></h4>
28+
<h3><a href="{{ $p.RelPermalink}}{{ with .anchor }}#{{ . | anchorize }}{{ end }}">{{ .title }}</a></h3>
2929
{{ $description := .description | default $p.Params.description }}
3030
{{ $description | markdownify }}
3131
{{ end }}
3232
</div>
33-
3433
{{ end }}
3534
</div>
3635
</section>

0 commit comments

Comments
 (0)