diff --git a/apps/laboratory/src/components/Theming/BorderRadiusInput.tsx b/apps/laboratory/src/components/Theming/BorderRadiusInput.tsx new file mode 100644 index 0000000000..17f2e0a011 --- /dev/null +++ b/apps/laboratory/src/components/Theming/BorderRadiusInput.tsx @@ -0,0 +1,48 @@ +import { + Heading, + Slider, + SliderFilledTrack, + SliderMark, + SliderThumb, + SliderTrack +} from '@chakra-ui/react' + +import { ThemeStore } from '../../utils/StoreUtil' +import { useProxy } from 'valtio/utils' + +export default function BorderRadiusInput() { + const state = useProxy(ThemeStore.state) + + return ( + <> + + Border Radius + + { + ThemeStore.setBorderRadius(`${val}px`) + }} + > + + {state.borderRadius} + + + + + + + + ) +} diff --git a/apps/laboratory/src/layout/Header.tsx b/apps/laboratory/src/layout/Header.tsx index 469372f39d..0fdbcdfa49 100644 --- a/apps/laboratory/src/layout/Header.tsx +++ b/apps/laboratory/src/layout/Header.tsx @@ -18,6 +18,7 @@ import { } from '@chakra-ui/react' import MixColorInput from '../components/Theming/MixColorInput' import AccentColorInput from '../components/Theming/AccentColorInput' +import BorderRadiusInput from '../components/Theming/BorderRadiusInput' export default function Header() { const { colorMode, toggleColorMode } = useColorMode() @@ -38,6 +39,9 @@ export default function Header() { + + + diff --git a/apps/laboratory/src/utils/StoreUtil.ts b/apps/laboratory/src/utils/StoreUtil.ts index dee9b524f6..8b27434162 100644 --- a/apps/laboratory/src/utils/StoreUtil.ts +++ b/apps/laboratory/src/utils/StoreUtil.ts @@ -14,6 +14,7 @@ interface ThemeStoreState { mixColorStrength: number mixColor?: string accentColor?: string + borderRadius: string themeVariables: ThemeVariables } @@ -21,6 +22,7 @@ const state = proxy({ mixColorStrength: 0, mixColor: undefined, accentColor: undefined, + borderRadius: '4px', themeVariables: {} }) @@ -42,6 +44,11 @@ export const ThemeStore = { modal.setThemeVariables({ '--w3m-accent': value }) }, + setBorderRadius(value: ThemeStoreState['borderRadius']) { + state.borderRadius = value + modal.setThemeVariables({ '--w3m-border-radius-master': value }) + }, + setThemeVariables(value: ThemeStoreState['themeVariables']) { state.themeVariables = value modal.setThemeVariables(value)