Skip to content

Commit 54712a3

Browse files
committed
Cards: Make cards fully clickable + small bug fix with grid ordering
1 parent 6d99370 commit 54712a3

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

assets/css/v2/style.css

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,12 @@ nav {
779779
a {
780780
color: oklch(var(--color-foreground));
781781
text-decoration-color: oklch(var(--color-background));
782+
783+
&:hover {
784+
box-shadow: 3px 3px 0px oklch(var(--color-brand) / 0.4);
785+
text-decoration-color: oklch(var(--color-background));
786+
border: 1px solid oklch(var(--color-brand) / 0.8);
787+
}
782788
}
783789

784790
.headerlink {
@@ -791,17 +797,11 @@ nav {
791797
}
792798

793799
> * {
794-
grid-row: 1;
795800
grid-column: 1 / -1;
796801
}
797802

798-
p {
799-
grid-row: 2;
800-
}
801-
802-
.card-layout {
803-
grid-row: 3;
804-
grid-column: 1 / -1;
803+
> p {
804+
grid-column: 1;
805805
}
806806
}
807807
}
@@ -1489,9 +1489,11 @@ h6:has(a):hover {
14891489
}
14901490

14911491
.card {
1492-
display: flex;
1493-
flex-direction: column;
1494-
gap: 0.5rem;
1492+
.card-container {
1493+
display: flex;
1494+
flex-direction: column;
1495+
gap: 0.5rem;
1496+
}
14951497

14961498
.card-header {
14971499
display: flex;

layouts/shortcodes/card-section.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="card-section{{if eq $isFeaturedSection "true"}}featured-section{{ end }}">
2121
{{- if $title -}}
2222
<strong class="card-section-title">{{- $title -}}</strong>
23-
<div class="card-section-content{{ if eq $showAsCards "true" }} {{ $class }}{{ end }}">{{- .Inner -}}</div>
23+
<div class="card-section-content{{ if eq $showAsCards "true" }} {{ $class }}{{ end }}">{{ .Inner }}</div>
2424
{{ else }}
2525
<div class="card-section-content{{ if eq $showAsCards "true" }} {{ $class }}{{ end }}">{{ .Inner }}</div>
2626
{{ end }}

layouts/shortcodes/card.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $title := .Get "title" -}}
2-
{{- $titleUrl := .Get "titleUrl" | default "/" -}}
2+
{{- $titleUrl := .Get "titleUrl" | default "." -}}
33
{{- $icon := .Get "icon" | default "book-open" -}}
44
{{- $brandIcon := .Get "brandIcon" -}}
55
{{- $isFeaturedParam := .Get "isFeatured" | default "false" }}
@@ -34,27 +34,23 @@
3434

3535
{{- /* Validate that the parent is card-section and under 3 cards */ -}}
3636
{{- if (eq .Parent.Name "card-section") -}}
37-
<div class="card{{ if eq $isFeatured "true" }} featured-card{{ end }}" data-grid="{{ $dataGrid }}">
37+
<a href="{{- $titleUrl -}}" alt="{{- $title -}}" class="card{{ if eq $isFeatured "true" }} featured-card{{ end }}" data-grid="{{ $dataGrid }}">
38+
<div class="card-container">
3839
{{- if $title -}}
3940
<div class="card-header">
4041
{{- if $brandIcon -}}
4142
<img class="card-brand-icon" src="/images/icons/{{ $brandIcon }}.svg">
42-
{{- else -}}
43-
{{- if $icon -}}
44-
{{ partial "lucide" (dict "context" . "icon" $icon) }}
45-
{{- end -}}
46-
{{- end -}}
47-
{{- if $titleUrl -}}
48-
<h2 class="card-title"><a href="{{- $titleUrl -}}">{{- $title -}}</a></h2>
49-
{{- else -}}
50-
<h2 class="card-title">{{- $title -}}</h2>
43+
{{- else if $icon -}}
44+
{{ partial "lucide" (dict "context" . "icon" $icon) }}
5145
{{- end -}}
46+
<h2 class="card-title">{{- $title -}}</h2>
5247
</div>
5348
{{- else -}}
5449
{{ errorf "Mainframe: Missing param 'title'" }}
5550
{{- end -}}
56-
{{ .Inner }}
51+
<div class="card-content">{{ .Inner }}</div>
5752
</div>
53+
</a>
5854
{{- else -}}
5955
{{ errorf "The '<card>' must be nested directly inside the shortcode '<card-section>'. Please see the exampleSite for an example of usage." }}
6056
{{- end -}}

0 commit comments

Comments
 (0)