parent
0448564fb7
commit
8ef1bf6e3a
6 changed files with 154 additions and 100 deletions
@ -0,0 +1,9 @@ |
||||
const ItemColor = ({ item, theme, className, onClick }) => { |
||||
return ( |
||||
<div className={className} onClick={onClick}> |
||||
{item} |
||||
<p className="text-xs">{theme[item]}</p> |
||||
</div> |
||||
); |
||||
}; |
||||
export default ItemColor; |
@ -0,0 +1,13 @@ |
||||
const defaultTheme = { |
||||
primary: "#61DAFB", |
||||
primaryText: "#000000", |
||||
primaryDark: "#61DAFB", |
||||
primaryLight: "#61DAFB", |
||||
secondary: "#254E70", |
||||
secondaryText: "#000000", |
||||
secondaryDark: "#61DAFB", |
||||
secondaryLight: "#61DAFB", |
||||
}; |
||||
const classNames = |
||||
"bg-primary text-primaryText bg-secondary text-secondaryText bg-primaryDark bg-primaryLight text-primaryDark text-primaryLight bg-primaryDark bg-secondaryLight text-secondaryDark text-secondaryLight bg-secondaryDark text-secondaryDark "; |
||||
export default defaultTheme; |
@ -0,0 +1,16 @@ |
||||
import { SketchPicker } from "react-color"; |
||||
import { useState } from "react"; |
||||
const Picker = ({ theme, item, setTheme }) => { |
||||
const [color, setColor] = useState(theme[item]); |
||||
return ( |
||||
<SketchPicker |
||||
className="absolute bottom-16 left-0" |
||||
color={color} |
||||
onChange={(updatedColor) => { |
||||
setColor(updatedColor.hex); |
||||
setTheme({ ...theme, [item]: updatedColor.hex }); |
||||
}} |
||||
/> |
||||
); |
||||
}; |
||||
export default Picker; |
@ -0,0 +1,9 @@ |
||||
const putTheme = (theme) => { |
||||
const root = document.documentElement; |
||||
Object.keys(theme).forEach((property) => { |
||||
if (property === "name") return; |
||||
root.style.setProperty(`--theme-${property}`, theme[property]); |
||||
}); |
||||
}; |
||||
putTheme({}); |
||||
export default putTheme; |
Loading…
Reference in new issue