summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-14 20:53:36 +0200
committerDanilo M. <danix@danix.xyz>2026-05-14 20:53:36 +0200
commit0c60fe67de91e4c798c02c6305819d8d25fa8f4e (patch)
tree6fd29814769eaaf1b82c576923fc9d6aaec1ac6e /layouts
parent3661990df76a543a8cd1ce5cfedd33a0166838ff (diff)
downloaddanixxyz-theme-0c60fe67de91e4c798c02c6305819d8d25fa8f4e.tar.gz
danixxyz-theme-0c60fe67de91e4c798c02c6305819d8d25fa8f4e.zip
fix: resolve post-review issues in pkg-list shortcode
- Replace data-feather icon with inline SVG (feather.replace() runs before Alpine renders x-for rows, so dynamic icons never rendered) - Add defer to pkg-list.js and pkg-changelog.js script tags - Add missing i18n keys: pkg_list_no_results, pkg_list_col_package, pkg_list_col_version, pkg_list_col_link (EN + IT) - Use i18n.noResults, i18n.colPkg/Ver/Link in template - Fix aria-label to use i18n.view instead of hardcoded "View" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/shortcodes/pkg-list.html28
2 files changed, 18 insertions, 14 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 50bdf39..734c808 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -93,9 +93,9 @@
<!-- Package repository shortcodes -->
{{ $pkgListScript := resources.Get "js/pkg-list.js" | minify }}
- <script src="{{ $pkgListScript.RelPermalink }}"></script>
+ <script src="{{ $pkgListScript.RelPermalink }}" defer></script>
{{ $pkgChangelogScript := resources.Get "js/pkg-changelog.js" | minify }}
- <script src="{{ $pkgChangelogScript.RelPermalink }}"></script>
+ <script src="{{ $pkgChangelogScript.RelPermalink }}" defer></script>
<!-- 404 Not Found page script -->
{{ $notFoundScript := resources.Get "js/not-found-page.js" | minify }}
diff --git a/layouts/shortcodes/pkg-list.html b/layouts/shortcodes/pkg-list.html
index df382dd..b1c2cdf 100644
--- a/layouts/shortcodes/pkg-list.html
+++ b/layouts/shortcodes/pkg-list.html
@@ -1,10 +1,14 @@
-{{- $loading := i18n "pkg_list_loading" | default "Loading packages..." -}}
-{{- $error := i18n "pkg_list_error" | default "Could not load packages." -}}
-{{- $filter := i18n "pkg_list_filter" | default "Filter packages..." -}}
-{{- $view := i18n "pkg_list_link_label" | default "View" -}}
+{{- $loading := i18n "pkg_list_loading" | default "Loading packages..." -}}
+{{- $error := i18n "pkg_list_error" | default "Could not load packages." -}}
+{{- $filter := i18n "pkg_list_filter" | default "Filter packages..." -}}
+{{- $view := i18n "pkg_list_link_label" | default "View" -}}
+{{- $noResults := i18n "pkg_list_no_results" | default "No packages match your filter." -}}
+{{- $colPkg := i18n "pkg_list_col_package" | default "Package" -}}
+{{- $colVer := i18n "pkg_list_col_version" | default "Version" -}}
+{{- $colLink := i18n "pkg_list_col_link" | default "Link" -}}
<div
- x-data="pkgList({ loading: {{ $loading | jsonify }}, error: {{ $error | jsonify }}, filter: {{ $filter | jsonify }}, view: {{ $view | jsonify }} })"
+ x-data="pkgList({ loading: {{ $loading | jsonify }}, error: {{ $error | jsonify }}, filter: {{ $filter | jsonify }}, view: {{ $view | jsonify }}, noResults: {{ $noResults | jsonify }}, colPkg: {{ $colPkg | jsonify }}, colVer: {{ $colVer | jsonify }}, colLink: {{ $colLink | jsonify }} })"
x-init="init()"
class="not-prose my-6"
>
@@ -28,16 +32,16 @@
x-model="filter"
:placeholder="i18n.filter"
class="w-full sm:w-72 px-3 py-2 text-sm bg-bg border border-border/50 rounded-lg text-text placeholder-text-dim focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent transition-colors"
- aria-label="Filter packages"
+ :aria-label="i18n.filter"
/>
</div>
<div class="overflow-x-auto rounded-lg border border-border/50">
<table class="w-full text-sm text-left">
<thead class="bg-surface text-text-dim uppercase text-xs tracking-wide">
<tr>
- <th class="px-4 py-3">Package</th>
- <th class="px-4 py-3">Version</th>
- <th class="px-4 py-3 text-right">Link</th>
+ <th class="px-4 py-3" x-text="i18n.colPkg"></th>
+ <th class="px-4 py-3" x-text="i18n.colVer"></th>
+ <th class="px-4 py-3 text-right" x-text="i18n.colLink"></th>
</tr>
</thead>
<tbody class="divide-y divide-border/30">
@@ -51,16 +55,16 @@
target="_blank"
rel="noopener"
class="inline-flex items-center gap-1 text-accent hover:underline text-xs"
- :aria-label="'View ' + pkg.name + ' in repository'"
+ :aria-label="i18n.view + ' ' + pkg.name"
>
<span x-text="pkg.label"></span>
- <i data-feather="external-link" class="w-3 h-3" aria-hidden="true"></i>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-3 h-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
</a>
</td>
</tr>
</template>
<tr x-show="filtered.length === 0">
- <td colspan="3" class="px-4 py-4 text-center text-text-dim text-sm">No packages match your filter.</td>
+ <td colspan="3" class="px-4 py-4 text-center text-text-dim text-sm" x-text="i18n.noResults"></td>
</tr>
</tbody>
</table>