Skip to content

Commit 8ad4889

Browse files
committed
feat(hardware): Add related content partial
This adds a partial for displaying related content and events.
1 parent 8b1d62b commit 8ad4889

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{{ $related_content := . }}
2+
3+
{{ if $related_content }}
4+
<div class="related-content-section mt-12 pt-8 pb-8">
5+
<h2 class="text-3xl font-bold mb-8">Related Content & Events</h2>
6+
7+
<div class="space-y-6">
8+
{{ range $item := $related_content }}
9+
<div class="timeline-item-content">
10+
<div class="flex flex-col md:flex-row items-start gap-5">
11+
12+
{{/* Thumbnail Column */}}
13+
<div class="flex-shrink-0 w-full md:w-40 text-center">
14+
<a href="{{ $item.RelPermalink }}">
15+
{{ $image_param := $item.Params.image }}
16+
{{ $img_path := "" }}
17+
{{ $img_alt := $item.Title }}
18+
19+
{{ if $image_param }}
20+
{{ $img_path_cleaned := strings.TrimPrefix "/" $image_param }}
21+
{{ $resource := "" }}
22+
{{ with $item.Resources.GetMatch $image_param }}
23+
{{ $resource = . }}
24+
{{ else }}
25+
{{ with resources.Get $img_path_cleaned }}
26+
{{ $resource = . }}
27+
{{ end }}
28+
{{ end }}
29+
30+
{{ if $resource }}
31+
{{ $img_path = ($resource.Fill "160x90 Lanczos").RelPermalink }}
32+
{{ else if fileExists (printf "static/%s" $img_path_cleaned) }}
33+
{{ $img_path = $image_param | relURL }}
34+
{{ end }}
35+
{{ end }}
36+
37+
{{ if not $img_path }}
38+
{{ with resources.Get "images/workshop-thumbnail-default.png" }}
39+
{{ $img_path = (.Fill "160x90 Lanczos").RelPermalink }}
40+
{{ $img_alt = "Default Open Neuromorphic Event Thumbnail" }}
41+
{{ end }}
42+
{{ end }}
43+
44+
{{ if $img_path }}
45+
<img src="{{ $img_path }}" alt="{{ $img_alt }}" class="w-full h-auto rounded-md object-cover">
46+
{{ else }}
47+
<div class="w-full h-[90px] bg-gray-200 dark:bg-darkmode-theme-dark rounded-md flex items-center justify-center">
48+
{{ partial "icon.html" (dict "style" "regular" "name" "images" "class" "text-4xl text-gray-400") }}
49+
</div>
50+
{{ end }}
51+
</a>
52+
</div>
53+
54+
{{/* Content Column */}}
55+
<div class="flex-grow">
56+
<div class="flex justify-between items-start gap-4">
57+
<div>
58+
<h4 class="text-xl font-semibold mb-1">
59+
<a href="{{ $item.RelPermalink }}" class="text-dark dark:text-darkmode-dark hover:text-primary dark:hover:text-darkmode-primary">{{ $item.Title }}</a>
60+
</h4>
61+
<p class="text-sm text-gray-500 dark:text-gray-400">
62+
{{ $item.Date.Format "January 2, 2006" }}
63+
</p>
64+
</div>
65+
<span class="timeline-item-badge flex-shrink-0">
66+
{{ $item.Type | default $item.Section | humanize | title }}
67+
</span>
68+
</div>
69+
{{ if $item.Description }}
70+
<p class="text-gray-600 dark:text-gray-400 mt-3 text-sm">{{ $item.Description | truncate 150 }}</p>
71+
{{ end }}
72+
</div>
73+
74+
</div>
75+
</div>
76+
{{ end }}
77+
</div>
78+
</div>
79+
{{ end }}

0 commit comments

Comments
 (0)