Skip to content

Added new param to card shortcode #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions assets/css/v2/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,14 @@ h6:has(a):hover {
gap: 1.5rem;
margin-top: 1rem;

.card-container.long {
grid-column: 1 / -1;
}

.card-container.short {
grid-column: auto;
}

.card-container {
border: 1px solid oklch(var(--color-codeblock-border));
box-shadow: 3px 3px 0px oklch(var(--color-shadow));
Expand Down
6 changes: 6 additions & 0 deletions exampleSite/content/test-product/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ hasCustomContent: true
{{< card title="NGINX Plus" titleUrl="/nginx/" >}}
Installing NGINX
{{</ card >}}
{{< card title="NGINX Plus" titleUrl="/nginx/" >}}
Installing NGINX
{{</ card >}}
{{< card title="Test Product" titleUrl="/test-product/" sizeOption="long" >}}
Test Product
{{</ card >}}
{{</ card-section >}}
{{</ card-layout >}}
3 changes: 2 additions & 1 deletion layouts/shortcodes/card.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{- $title := .Get "title" -}}
{{- $titleUrl := .Get "titleUrl" | default "/" -}}
{{- $icon := .Get "icon" | default "NGINX-product-icon" -}}
{{- $sizeOption := .Get "sizeOption" | default "short" -}}
{{- $current := .Page.Scratch.Get "cards" | default (slice) -}}
{{- $newCard := dict "title" ($title) "content" (.Inner) -}}
{{- .Page.Scratch.Set "cards" ($current | append $newCard) -}}
{{- /* Validate that the parent is card-section */ -}}
{{- if eq .Parent.Name "card-section" -}}
<div class="card-container" style="display: none;" data-mf="true">
<div class="card-container {{ $sizeOption }}" style="display: none;" data-mf="true">
{{- if $title -}}
{{- if $titleUrl -}}
<h2 class="card-title"><a href="{{- $titleUrl -}}">{{- $title -}}</a></h2>
Expand Down
Loading