sendou.ink/components/layout/ColorModeSwitcher.tsx
Kalle af3a654595
Customize profile colors (#603)
* 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
2021-07-29 20:30:47 +03:00

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;