Skip to content

Commit b252f10

Browse files
committed
fix(team-showcase): honor sort direction and improve portrait layout
1 parent ac0f161 commit b252f10

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

modules/blox/blox/team-showcase/block.html

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
{{ $text := "" }}
5252
{{ with index $content "text" }}{{ $text = printf "%v" . | emojify | $page.RenderString }}{{ end }}
5353
{{ $alignClass := cond (eq $align "left") "items-start text-left" "items-center text-center" }}
54+
{{ $headerWidthClass := cond (eq $align "left") "max-w-5xl" "max-w-3xl mx-auto" }}
5455
{{ $ctaAlignClass := cond (eq $align "left") "text-left" "text-center" }}
5556

5657
{{ $columnsClasses := dict
@@ -64,7 +65,7 @@
6465
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
6566

6667
{{/* Section Header */}}
67-
<div class="flex flex-col {{ $alignClass }} mb-12">
68+
<div class="flex flex-col gap-4 {{ $alignClass }} {{ $headerWidthClass }} mb-12">
6869
{{ with $title }}
6970
<h2 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-white tracking-tight">
7071
{{ . }}
@@ -136,7 +137,7 @@ <h2 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-wh
136137
{{ $groupSortFieldLc = lower $groupSortField }}
137138
{{ end }}
138139
{{ $groupIsNumeric := or (eq $groupSortFieldLc "weight") (eq $groupSortFieldLc "graduation_year") }}
139-
{{ $groupOrder := cond (and (not $groupIsNumeric) (not $groupSortAsc)) "desc" "asc" }}
140+
{{ $groupOrder := cond $groupSortAsc "asc" "desc" }}
140141

141142
{{ $groupProfiles := slice }}
142143
{{ range $allProfiles }}
@@ -164,7 +165,8 @@ <h2 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-wh
164165
{{ if or (eq $groupSortFieldLc "name.family") (eq $groupSortFieldLc "family") (eq $groupSortFieldLc "last_name") (eq $groupSortFieldLc "name_family") (eq $groupSortFieldLc "family_name") }}
165166
{{ $primary = $familyLower }}
166167
{{ else if $isNumeric }}
167-
{{ $primary = 999999 }}
168+
{{ $missingSentinel := cond $groupSortAsc 999999 -999999 }}
169+
{{ $primary = $missingSentinel }}
168170
{{ if or (eq $rawType "int") (eq $rawType "int64") (eq $rawType "float64") (eq $rawType "float32") (eq $rawType "uint") (eq $rawType "uint64") }}
169171
{{ $primary = int $raw }}
170172
{{ else if and (eq $rawType "string") (gt (len (findRE "^[0-9]+$" $raw)) 0) }}
@@ -177,7 +179,8 @@ <h2 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 dark:text-wh
177179
{{ end }}
178180
{{ $sortKey := "" }}
179181
{{ if $isNumeric }}
180-
{{ $num := $primary | default 999999 }}
182+
{{ $missingSentinel := cond $groupSortAsc 999999 -999999 }}
183+
{{ $num := $primary | default $missingSentinel }}
181184
{{ $sortKey = printf "%010d|%s" $num $familyLower }}
182185
{{ else }}
183186
{{ $sortKey = printf "%s|%s" $primary $familyLower }}
@@ -214,15 +217,15 @@ <h3 class="text-2xl font-bold text-gray-900 dark:text-white mb-6 pb-2 border-b b
214217
<div class="group relative">
215218
<div class="relative overflow-hidden rounded-2xl bg-white dark:bg-gray-800 shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1">
216219

217-
<a href="{{ $link }}" class="block relative h-64 overflow-hidden" aria-label="{{ $profile.title }}">
220+
<a href="{{ $link }}" class="block relative aspect-[4/5] overflow-hidden" aria-label="{{ $profile.title }}">
218221
{{ if $avatar }}
219-
{{ $image := $avatar.Fill "400x400 Center webp" }}
222+
{{ $image := $avatar.Fit "400x500 Center webp" }}
220223
<img src="{{ $image.RelPermalink }}"
221224
alt="{{ $profile.title }}"
222225
width="{{ $image.Width }}"
223226
height="{{ $image.Height }}"
224227
loading="lazy"
225-
class="w-full h-full object-cover transition-transform duration-300 group-hover:scale-110">
228+
class="w-full h-full object-cover object-center transition-transform duration-300 group-hover:scale-110">
226229
<div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
227230
{{ else }}
228231
<div class="absolute inset-0 bg-gray-100 dark:bg-gray-700 flex items-center justify-center text-4xl font-semibold text-gray-600 dark:text-gray-200">
@@ -367,7 +370,7 @@ <h3 class="text-xl font-bold text-gray-900 dark:text-white mb-1">
367370
{{ end }}
368371
{{ else }}
369372
{{ $isNumeric := or (eq $sort_field_lc "weight") (eq $sort_field_lc "graduation_year") }}
370-
{{ $order := cond (and (not $isNumeric) (not $sort_asc)) "desc" "asc" }}
373+
{{ $order := cond $sort_asc "asc" "desc" }}
371374
{{ $sorted := slice }}
372375
{{ range $allProfiles }}
373376
{{ $profile := .profile }}
@@ -380,7 +383,8 @@ <h3 class="text-xl font-bold text-gray-900 dark:text-white mb-1">
380383
{{ if or (eq $sort_field_lc "name.family") (eq $sort_field_lc "family") (eq $sort_field_lc "last_name") (eq $sort_field_lc "name_family") (eq $sort_field_lc "family_name") }}
381384
{{ $primary = $familyLower }}
382385
{{ else if $isNumeric }}
383-
{{ $primary = 999999 }}
386+
{{ $missingSentinel := cond $sort_asc 999999 -999999 }}
387+
{{ $primary = $missingSentinel }}
384388
{{ if or (eq $rawType "int") (eq $rawType "int64") (eq $rawType "float64") (eq $rawType "float32") (eq $rawType "uint") (eq $rawType "uint64") }}
385389
{{ $primary = int $raw }}
386390
{{ else if and (eq $rawType "string") (gt (len (findRE "^[0-9]+$" $raw)) 0) }}
@@ -393,7 +397,8 @@ <h3 class="text-xl font-bold text-gray-900 dark:text-white mb-1">
393397
{{ end }}
394398
{{ $sortKey := "" }}
395399
{{ if $isNumeric }}
396-
{{ $num := $primary | default 999999 }}
400+
{{ $missingSentinel := cond $sort_asc 999999 -999999 }}
401+
{{ $num := $primary | default $missingSentinel }}
397402
{{ $sortKey = printf "%010d|%s" $num $familyLower }}
398403
{{ else }}
399404
{{ $sortKey = printf "%s|%s" $primary $familyLower }}
@@ -410,15 +415,15 @@ <h3 class="text-xl font-bold text-gray-900 dark:text-white mb-1">
410415
{{ $initial := cond (gt (len $nameSource) 0) (upper (substr $nameSource 0 1)) "?" }}
411416
<div class="group relative">
412417
<div class="relative overflow-hidden rounded-2xl bg-white dark:bg-gray-800 shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1">
413-
<a href="{{ $link }}" class="block relative h-64 overflow-hidden" aria-label="{{ $profile.title }}">
418+
<a href="{{ $link }}" class="block relative aspect-[4/5] overflow-hidden" aria-label="{{ $profile.title }}">
414419
{{ if $avatar }}
415-
{{ $image := $avatar.Fill "400x400 Center webp" }}
420+
{{ $image := $avatar.Fit "400x500 Center webp" }}
416421
<img src="{{ $image.RelPermalink }}"
417422
alt="{{ $profile.title }}"
418423
width="{{ $image.Width }}"
419424
height="{{ $image.Height }}"
420425
loading="lazy"
421-
class="w-full h-full object-cover transition-transform duration-300 group-hover:scale-110">
426+
class="w-full h-full object-cover object-center transition-transform duration-300 group-hover:scale-110">
422427
<div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
423428
{{ else }}
424429
<div class="absolute inset-0 bg-gray-100 dark:bg-gray-700 flex items-center justify-center text-4xl font-semibold text-gray-600 dark:text-gray-200">

0 commit comments

Comments
 (0)