1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-16 20:05:31 -04:00

ThemeToggle.module.scss -> inline style

removes an unnecessary call to a very small CSS file since the toggle is loaded dynamically
This commit is contained in:
2022-01-04 10:18:12 -05:00
parent 206bbd278f
commit 70778db89d
2 changed files with 6 additions and 9 deletions

View File

@@ -1,6 +0,0 @@
.toggle {
border: 0;
padding: 0;
background: none;
cursor: pointer;
}

View File

@@ -2,8 +2,6 @@ import { useState, useEffect, useCallback } from "react";
import * as config from "../../lib/config";
import { BulbOffIcon, BulbOnIcon } from "../icons";
import styles from "./ThemeToggle.module.scss";
// store preference in local storage
const storageKey = "dark_mode";
const getDarkPref = () => localStorage.getItem(storageKey);
@@ -58,10 +56,15 @@ const ThemeToggle = ({ className = "" }) => {
return (
<button
className={styles.toggle}
onClick={handleToggle}
title={dark ? "Toggle Light Mode" : "Toggle Dark Mode"}
aria-label={dark ? "Toggle Light Mode" : "Toggle Dark Mode"}
style={{
border: 0,
padding: 0,
background: "none",
cursor: "pointer",
}}
>
{dark ? <BulbOffIcon className={`icon ${className}`} /> : <BulbOnIcon className={`icon ${className}`} />}
</button>