diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index fdf42d15..b1e23cd4 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -1199,77 +1199,144 @@ h6:has(a):hover { color: oklch(var(--color-brand)); } -/* Landing page cards */ -.text-content .card-layout { +/* Product landing page cards */ +.card-brand-icon { + margin: 0; +} + +.card[data-grid="half"] { + grid-column: 1; +} + +.card[data-grid="wide"] { grid-column: 1; +} + +@media (min-width: 55rem) { + .card[data-grid="half"] { + grid-column: span 6; + } + + .card[data-grid="wide"] { + grid-column: 1 / -1; + } +} + +.card-layout { + display: flex; + flex-direction: column; + gap: 1.5rem; .card-section { display: flex; flex-direction: column; - gap: 1rem; - - strong { - font-weight: 500; - } + gap: 1.5rem; - /* Hide all the cards past 3 if it is a featured card section */ &.featured-section { - .card-section-content.card-grid - > *:nth-child(n + 4 of div.card-container) { + /* Hide all the cards past 3 if it is a featured card section */ + .card-section-content > *:nth-child(n + 4 of a.card) { display: none; } } - } -} -/* Optional grid layout */ -.card-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(33%, 1fr)); - gap: 1.5rem; + .card-section-title { + font-weight: 500; + font-size: var(--font-step-2); + display: block; + } - .card-container { - border: 1px solid oklch(var(--color-codeblock-border)); - box-shadow: 3px 3px 0px oklch(var(--color-shadow)); - padding: 1rem; + .card-section-content { + display: flex; + flex-direction: column; + gap: 1rem; - &.featured-card { - /* If there is a featured card, only the featured card should be full length */ - grid-column: 1 / -1; + &.card-grid { + display: grid; + grid-template-columns: repeat(12, 1fr); + gap: 1.5rem; + + @media (max-width: 55rem) { + grid-template-columns: 1fr; + } - /* If there is a featured card AND two cards, the last one should be full length */ - ~ .card-container:nth-child(2n):last-child { - grid-column: 1 / -1; + .card { + border: 1px solid oklch(var(--color-codeblock-border)); + box-shadow: 3px 3px 0px oklch(var(--color-shadow)); + padding: 1rem; + order: 2; + } } - } - } - /* If there is no featured card, last card that is the 3rd one should be full width */ - &:not(:has(.featured-card)) *:nth-child(n + 3 of div.card-container) { - grid-column: 1 / -1; + .card { + color: oklch(var(--color-foreground)); + text-decoration: none; + + .card-container { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + + .card-header { + display: flex; + flex-direction: row; + gap: 1rem; + align-items: center; + color: oklch(var(--color-brand)); + + img.card-brand-icon { + height: 1.5rem; + width: auto; + } + + h2 { + padding: 0; + margin: 0; + font-size: var(--font-step-1); + } + } + } + } } } -.card-container { - display: flex; - flex-direction: column; - gap: 0.5rem; - margin-bottom: 1rem; +/* Home landing page cards */ +.homepage .card-layout { + margin-block-end: 3rem; + gap: 3rem; - .card-header { - display: flex; - flex-direction: row; - gap: 0.5rem; + .card-section { + .card-section-content.card-grid { + grid-template-columns: 1fr; - .card-brand-icon { - height: 20px; - width: auto; - } + @media (min-width: 70rem) { + grid-template-columns: repeat(12, 1fr); + grid-auto-rows: 1fr; + } - h2 { - padding: 0; - margin: 0; - font-size: 1rem; + .card { + padding: 1rem 2rem 2rem 2rem; + + .card-container { + height: 7rem; + justify-content: space-around; + + .card-header { + justify-content: flex-start; + + .card-brand-icon { + height: 40px; + width: auto; + } + } + } + + &:hover { + box-shadow: 3px 3px 0px oklch(var(--color-brand) / 0.4); + text-decoration-color: oklch(var(--color-background)); + border: 1px solid oklch(var(--color-brand) / 0.8); + } + } } } } diff --git a/exampleSite/content/test-product/_index.md b/exampleSite/content/test-product/_index.md index 0a681ba0..8de4de0f 100644 --- a/exampleSite/content/test-product/_index.md +++ b/exampleSite/content/test-product/_index.md @@ -11,7 +11,7 @@ cascade: --- {{}} {{}} - {{}} + {{}} All shortcodes in one page. {{}} {{}} @@ -29,7 +29,7 @@ cascade: [//]: # "Provide any sort of additional supporting content you may want customers to see as well (e.g. more cards, diagrams, changelogs, etc.)" {{}} {{}} - {{}} + {{}} Installing NGINX {{}} {{}} diff --git a/layouts/shortcodes/card-layout.html b/layouts/shortcodes/card-layout.html index 77f8f58e..57d83472 100644 --- a/layouts/shortcodes/card-layout.html +++ b/layouts/shortcodes/card-layout.html @@ -1,2 +1,2 @@ -
{{ .Inner | markdownify }}
\ No newline at end of file +
{{- .Inner | markdownify -}}
diff --git a/layouts/shortcodes/card-section.html b/layouts/shortcodes/card-section.html index 593d3afb..b042ebda 100644 --- a/layouts/shortcodes/card-section.html +++ b/layouts/shortcodes/card-section.html @@ -1,6 +1,7 @@ {{ $title := .Get "title" }} {{ $isFeaturedSectionParam := .Get "isFeaturedSection" | default "false" }} {{ $showAsCardsParam := .Get "showAsCards" | default "false"}} + {{- /* Validate the parameter strictly */ -}} {{- if not (in (slice "true" "false") $showAsCardsParam) -}} {{- warnf "The '' Shortcode parameter 'showAsCards' must be 'true' or 'false', but got: '%s'. This will now default to 'false'" $showAsCardsParam -}} @@ -15,14 +16,18 @@ {{- end -}} {{- $isFeaturedSection := cond (eq $isFeaturedSectionParam "true") "true" "false" -}} {{- $class := "card-grid" -}} + +{{- /* Get number of cards */ -}} +{{ $cardCount := len (findRE "" .Inner) }} + {{- /* Validate that the parent is card-layout */ -}} {{ if eq .Parent.Name "card-layout"}} -