From 08ddfe2db36ae6ed7c85f24a4c5e7276c24cc440 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Fri, 30 Apr 2021 15:38:28 +0000
Subject: [PATCH] refactor component
---
layouts/partials/functions/getIconPath.html | 4 ++++
layouts/partials/mode.html | 14 +-------------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/layouts/partials/functions/getIconPath.html b/layouts/partials/functions/getIconPath.html
new file mode 100644
index 0000000..fab0bc4
--- /dev/null
+++ b/layouts/partials/functions/getIconPath.html
@@ -0,0 +1,4 @@
+{{ $s := .Site }}
+{{ $sp := $s.Params }}
+{{ $iconsPath := "icons/" }}
+{{ return $iconsPath }}
\ No newline at end of file
diff --git a/layouts/partials/mode.html b/layouts/partials/mode.html
index d1cb403..29af215 100644
--- a/layouts/partials/mode.html
+++ b/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>
--
Gitblit v1.10.0