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

weru
30.36.2021 08ddfe2db36ae6ed7c85f24a4c5e7276c24cc440
refactor component

Signed-off-by: weru <fromweru@gmail.com>
1 files added
1 files modified
18 ■■■■ changed files
layouts/partials/functions/getIconPath.html 4 ●●●● patch | view | raw | blame | history
layouts/partials/mode.html 14 ●●●●● patch | view | raw | blame | history
layouts/partials/functions/getIconPath.html
New file
@@ -0,0 +1,4 @@
{{ $s := .Site }}
{{ $sp := $s.Params }}
{{ $iconsPath := "icons/" }}
{{ return $iconsPath }}
layouts/partials/mode.html
@@ -1,16 +1,4 @@
{{- $s := .Site }}
{{- $sp := $s.Params }}
{{- $iconsPath := "icons/" }}
<div class = 'color_mode'>
  <label for = 'mode'>
    {{- $litPath := absURL (printf "%ssun.svg" $iconsPath) }}
    {{- $darkPath := absURL (printf "%smoon.svg" $iconsPath) }}
    <picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
      {{ with $sp.enableDarkMode }}
        <source srcset = '{{ $darkPath }}' media="(prefers-color-scheme: dark)">
      {{ end }}
      <img srcset = '{{ $litPath }}' alt = 'Light/Dark Mode Icon' class="color_icon">
    </picture>
  </label>
  <label for = 'mode'></label>
  <input type = 'checkbox' class = 'color_choice' id = 'mode' title="Toggle Dark Mode">
</div>