mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-02 19:26:50 -05:00
* Variables rearranged * Make patron.json empty again * Fix styles.css * Working prototype * Table legible color * UI furthened * Set opaque theme color with custom colors * Control Color Selector with buttons * Show info if can't edit colors * borzoic can also edit colors * Add migration * Can send colors to backend * Edit existing colors * Use new layering strat for footer * useMutation custom hook * Footer adjusted text color * Reset style after profile visit * Set squid color after page load * Mutate user after color selection
29 lines
904 B
TypeScript
29 lines
904 B
TypeScript
import { IconButton, useColorMode } from "@chakra-ui/react";
|
|
import { FiMoon, FiSun } from "react-icons/fi";
|
|
|
|
const ColorModeSwitcher = ({ isMobile }: { isMobile?: boolean }) => {
|
|
const { colorMode, toggleColorMode } = useColorMode();
|
|
return (
|
|
<IconButton
|
|
data-cy="color-mode-toggle"
|
|
aria-label={`Switch to ${colorMode === "light" ? "dark" : "light"} mode`}
|
|
variant="ghost"
|
|
color="current"
|
|
onClick={toggleColorMode}
|
|
icon={colorMode === "light" ? <FiSun /> : <FiMoon />}
|
|
_hover={
|
|
colorMode === "dark"
|
|
? { bg: "white !important", color: "black" }
|
|
: { bg: "black !important", color: "white" }
|
|
}
|
|
borderRadius={isMobile ? "50%" : "0"}
|
|
size={isMobile ? "lg" : "sm"}
|
|
height="50px"
|
|
mx={2}
|
|
display={isMobile ? "flex" : ["none", null, null, "flex"]}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default ColorModeSwitcher;
|