Add Hex prompt

This commit is contained in:
Jeremy Thomas
2024-06-25 16:20:07 +01:00
parent 2cc6593269
commit cb2de3a2a2
5 changed files with 251 additions and 46 deletions

View File

@@ -49,15 +49,20 @@ function App() {
getVar: (id) => {
return context.cssvars[id];
},
updateVar: (id, newValue, unit) => {
const computedValue = `${newValue}${unit}`;
document.documentElement.style.setProperty(
`--bulma-${id}`,
computedValue,
);
updateVar: (id, newValue) => {
setContext((context) => {
const { start, unit } = context.cssvars[id];
const computedValue = `${newValue}${unit}`;
if (start === newValue) {
document.documentElement.style.removeProperty(`--bulma-${id}`);
} else {
document.documentElement.style.setProperty(
`--bulma-${id}`,
computedValue,
);
}
return {
...context,
cssvars: {