Skip to content

Commit b8b16de

Browse files
authored
Merge pull request #50983 from lmktfy/20241027_ready_case_studies_shortcode_docsy
Ready case studies shortcode for Docsy
2 parents 10b4d1e + 9c14c37 commit b8b16de

File tree

2 files changed

+66
-16
lines changed

2 files changed

+66
-16
lines changed

assets/scss/_custom.scss

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,58 @@ body.td-search {
19281928
color: #ffffff !important;
19291929
}
19301930

1931+
body.td-home section.case-studies {
1932+
h2, h3 {
1933+
text-align: center;
1934+
}
1935+
.case-study-list {
1936+
display: flex;
1937+
flex-direction: row;
1938+
max-width: 80vw;
1939+
margin-left: auto;
1940+
margin-right: auto;
1941+
align-items: stretch;
1942+
gap: clamp(1rem, 4em, 10vw);
1943+
> .case-study-item {
1944+
display: flex;
1945+
flex-direction: column;
1946+
justify-content: space-between;
1947+
text-align: center;
1948+
width: clamp(6rem, 20%, 50vw);
1949+
picture, picture img {
1950+
height: 4.8rem;
1951+
text-align: center;
1952+
}
1953+
> a {
1954+
display: block;
1955+
text-align: right;
1956+
}
1957+
}
1958+
padding-bottom: 2em;
1959+
}
1960+
padding-top: 4rem;
1961+
}
1962+
1963+
@media screen and (max-width: 768px) {
1964+
.case-study-list {
1965+
justify-content: center;
1966+
flex-wrap: wrap;
1967+
> .case-study-item {
1968+
min-width: 34vw;
1969+
}
1970+
}
1971+
}
1972+
1973+
@media screen and (max-width: 650px) {
1974+
.case-study-list {
1975+
> .case-study-item {
1976+
min-width: 51vw;
1977+
}
1978+
}
1979+
}
1980+
1981+
1982+
19311983
// handle main page features on narrow viewports
19321984
@media screen and (max-width: 768px) {
19331985
.features-container div.feature-box {
Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
{{ $caseStudiesSection := site.GetPage "case-studies" }}
2-
{{ if not $caseStudiesSection }}
1+
{{- $caseStudiesSection := site.GetPage "case-studies" -}}
2+
{{- if not $caseStudiesSection -}}
33
{{ errorf "[%s] No case-studies section found. Create content/%s/case-studies/_index.md" $.Page.Lang $.Page.Lang }}
4-
{{ else }}
4+
{{- else -}}
55
{{ $caseStudiesPages := where $caseStudiesSection.Pages "Params.featured" true | first 4 }}
6-
<section id="talkToUs">
7-
<div class="main-section">
8-
<h3 style="text-align: center"><a href="{{ $caseStudiesSection.RelPermalink }}" style="color: #3371E3; font-weight: 400">{{ $caseStudiesSection.LinkTitle }}</a></h3>
9-
<div id="caseStudiesWrapper">
10-
{{ range $caseStudiesPages }}
6+
<section class="case-studies">
7+
<h3><a href="{{ $caseStudiesSection.RelPermalink }}">{{ $caseStudiesSection.LinkTitle }}</a></h3>
8+
<div class="case-study-list">
9+
{{- range $caseStudiesPages -}}
1110
{{ $dark := .Resources.GetMatch "**{dark_logo}*.svg" }}
1211
{{ $logo := .Resources.GetMatch "**{featured_logo}*.svg" }}
1312

1413
{{ if not $logo }}
1514
{{ $logo = .Resources.GetMatch "**logo*.png" }}
1615
{{ end }}
17-
{{ if not $dark }}
18-
{{ $dark = $logo }}
19-
{{ end }}
20-
<div>
16+
{{- if not $dark -}}
17+
{{ $dark = $logo }}
18+
{{- end -}}
19+
<div class="case-study-item">
2120
<picture>
22-
<source srcset={{$dark.RelPermalink}} media="(prefers-color-scheme: dark)">
21+
<source srcset="{{$dark.RelPermalink}}" media="(prefers-color-scheme: dark)">
2322
<img src="{{ $logo.RelPermalink }}" alt="{{ .Title }}">
2423
</picture>
2524
<p>"{{ .Params.quote | truncate 100 }}"</p>
2625
<a href="{{ .RelPermalink }}">{{ T "main_read_more" }}</a>
2726
</div>
28-
{{ end }}
29-
</div>
27+
{{- end -}}
3028
</div>
3129
</section>
32-
{{ end }}
30+
{{- end -}}

0 commit comments

Comments
 (0)