mirror of https://github.com/onweru/compose.git

weru
24.36.2023 94d5d54c8da796d9e42b4208d8f70d70598c0fb4
refactor picture element #88

Signed-off-by: weru <fromweru@gmail.com>
2 files modified
13 ■■■■ changed files
layouts/partials/nav.html 10 ●●●● patch | view | raw | blame | history
layouts/shortcodes/picture.html 3 ●●●● patch | view | raw | blame | history
layouts/partials/nav.html
@@ -6,10 +6,7 @@
        {{- $litPath := absURL ($logos.lightMode) }}
        {{- $darkPath := absURL ($logos.darkMode) }}
        <picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
            {{ with $sp.enableDarkMode }}
            <source srcset = '{{ $darkPath }}' media="(prefers-color-scheme: dark)">
            {{ end }}
            <img srcset = '{{ $litPath }}' alt = '{{ $s.Title }} Logo'>
            <img src="{{ $litPath }}" alt="{{ $s.Title }} Logo">
        </picture>
        <label class="nav_toggle toggle" title='{{ T "site_menu" }}' role="button">
            {{ partial "sprite" (dict "icon" "harmburger") }}
@@ -40,10 +37,7 @@
                    {{- $litPath := absURL ($repo.iconLight) }}
                    {{- $darkPath := absURL ($repo.iconDark) }}
                    <picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
                        {{ with $sp.enableDarkMode }}
                            <source srcset = '{{ $darkPath }}' media="(prefers-color-scheme: dark)">
                        {{ end }}
                        <img srcset = '{{ $litPath }}' alt = '{{ $repo.name }} Repo'>
                        <img src="{{ $litPath }}" alt="{{ $repo.name }} Repo">
                    </picture>
                {{ else }}
                    {{ $repo.name }}
layouts/shortcodes/picture.html
@@ -4,6 +4,5 @@
{{- $litPath := absURL (printf "images/%s" $normal) }}
{{- $darkPath := absURL (printf "images/%s" $dark) }}
<picture class="nav_logo" data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
  <source srcset="{{ $darkPath }}" media="(prefers-color-scheme: dark)">
  <img srcset="{{ $litPath }}" alt="{{ $alt }}">
  <img src="{{ $litPath }}" alt="{{ $alt }}">
</picture>