colour swatches for theme builder
This commit is contained in:
parent
9f1878bb18
commit
f8a66fd1ca
2 changed files with 3 additions and 2 deletions
|
|
@ -24,6 +24,8 @@ const Value = ({ value, name, map, themeName, theme, setTheme }) => {
|
|||
setTheme(mutableTheme);
|
||||
};
|
||||
|
||||
const isColour = !/var\(.*\)/i.test(value) && CSS.supports('color', value);
|
||||
|
||||
return (
|
||||
<div className="value">
|
||||
<label>
|
||||
|
|
@ -31,7 +33,7 @@ const Value = ({ value, name, map, themeName, theme, setTheme }) => {
|
|||
<button className={isOpen ? 'open' : ''} onClick={() => setIsOpen(o => !o)}>
|
||||
<div>
|
||||
<span className="material-symbols-outlined">{isOpen ? 'expand_less' : 'expand_more'}</span>
|
||||
</div> {name}
|
||||
</div> {isColour && (<div style={{ background: value }}></div>)} {name}
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ SyntaxHighlighter.registerLanguage('svelte', svelteSyntax);
|
|||
SyntaxHighlighter.registerLanguage('scss', scss);
|
||||
|
||||
const NewTheme = ({ theme, themeName }) => {
|
||||
console.log('rerenders NewTheme');
|
||||
const originalTheme = themeName === 'light' ? lightTheme : darkTheme;
|
||||
const updates = updatedDiff(originalTheme, theme);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue