Skip to content

Commit

Permalink
Merge pull request #8 from giacomocerquone/target-fix
Browse files Browse the repository at this point in the history
fix target
  • Loading branch information
surjithctly authored Apr 1, 2024
2 parents 229217b + baf5f33 commit ccfb3dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro-color-scheme",
"version": "1.1.2",
"version": "1.1.3",
"description": "Perfect dark mode for Astro in few lines of code. Theme Toggle for Dark, Light & Auto (system)",
"type": "module",
"exports": {
Expand All @@ -20,4 +20,4 @@
"keywords": ["astro", "astro-component", "themes", "color-scheme", "dark", "dark-mode", "light", "system", "auto"],
"author": "Surjith S M",
"license": "MIT"
}
}
8 changes: 4 additions & 4 deletions src/ThemeSwitch.astro
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,29 @@ const { strategy, defaultTheme, as: Element = "span" } = Astro.props;
switch (strategy) {
case "button":
setupThemeSwitch("button", "click", (event) => {
const button = event.target;
const button = event.currentTarget;
const settheme = button.value === "dark" ? "light" : "dark";
button.value = settheme;
updateTheme(settheme);
});
break;
case "select":
setupThemeSwitch("select", "change", (event) => {
const select = event.target;
const select = event.currentTarget;
updateTheme(select.value);
});
break;
case "checkbox":
setupThemeSwitch("input", "change", (event) => {
const checkbox = event.target;
const checkbox = event.currentTarget;
const settheme = checkbox.value === "dark" ? "light" : "dark";
checkbox.value = settheme;
updateTheme(settheme);
});
break;
case "radio":
setupThemeSwitch("form", "click", (event) => {
updateTheme(event.target.value);
updateTheme(event.currentTarget.value);
});
break;
default:
Expand Down

0 comments on commit ccfb3dd

Please sign in to comment.