diff --git a/src/app/tools/embed/customize/[embed]/components/Radius.tsx b/src/app/tools/embed/customize/[embed]/components/Radius.tsx index 806975919..6d02f97fc 100644 --- a/src/app/tools/embed/customize/[embed]/components/Radius.tsx +++ b/src/app/tools/embed/customize/[embed]/components/Radius.tsx @@ -4,6 +4,7 @@ import { EmbedPreviewControllerProps } from '../page'; export function Radius({ configKey }: EmbedPreviewControllerProps) { const mutateEmbedState = EmbedState.useMutation(); + return ( + parseInt(state[configKey] as EmbedState.RadixSize), + ), + ]} + onValueChange={([value]) => { + mutateEmbedState((draft) => { + draft[configKey] = `${value}`; + }); + }} + /> + ); +} diff --git a/src/app/tools/embed/customize/[embed]/components/SizeWithout0.tsx b/src/app/tools/embed/customize/[embed]/components/SizeWithout0.tsx new file mode 100644 index 000000000..092cc0fe8 --- /dev/null +++ b/src/app/tools/embed/customize/[embed]/components/SizeWithout0.tsx @@ -0,0 +1,24 @@ +import { Slider } from '@radix-ui/themes'; +import * as EmbedState from '../../../../../../stores/embedState'; +import { EmbedPreviewControllerProps } from '../page'; + +export function SizeWithout0({ configKey }: EmbedPreviewControllerProps) { + const mutateEmbedState = EmbedState.useMutation(); + + return ( + + parseInt(state[configKey] as EmbedState.RadixSizeWithout0), + ), + ]} + onValueChange={([value]) => { + mutateEmbedState((draft) => { + draft[configKey] = `${value}`; + }); + }} + /> + ); +} diff --git a/src/app/tools/embed/customize/[embed]/components/Slider.tsx b/src/app/tools/embed/customize/[embed]/components/Slider.tsx new file mode 100644 index 000000000..c0d461a00 --- /dev/null +++ b/src/app/tools/embed/customize/[embed]/components/Slider.tsx @@ -0,0 +1,33 @@ +import { Slider as RadixSlider } from '@radix-ui/themes'; +import * as EmbedState from '../../../../../../stores/embedState'; +import { + EmbedConfigItemType, + EmbedItemType, +} from '../../../../../../stores/embedState/constants'; +import { EmbedPreviewControllerProps } from '../page'; + +export function Slider({ + configKey, + config, +}: EmbedPreviewControllerProps & { + config: EmbedConfigItemType; +}) { + const mutateEmbedState = EmbedState.useMutation(); + + return ( + + parseInt(state[configKey] as EmbedState.RadixSize), + ), + ]} + onValueChange={([value]) => { + mutateEmbedState((draft) => { + draft[configKey] = `${value}`; + }); + }} + /> + ); +} diff --git a/src/app/tools/embed/customize/[embed]/components/Text.tsx b/src/app/tools/embed/customize/[embed]/components/Text.tsx new file mode 100644 index 000000000..9e55ab579 --- /dev/null +++ b/src/app/tools/embed/customize/[embed]/components/Text.tsx @@ -0,0 +1,19 @@ +import { TextField } from '@radix-ui/themes'; +import * as EmbedState from '../../../../../../stores/embedState'; +import { EmbedPreviewControllerProps } from '../page'; + +export function Text({ configKey }: EmbedPreviewControllerProps) { + const mutateEmbedState = EmbedState.useMutation(); + + return ( + state[configKey] as string)} + onChange={(event) => { + mutateEmbedState((draft) => { + draft[configKey] = event.target.value; + }); + }} + /> + ); +} diff --git a/src/app/tools/embed/customize/[embed]/page.tsx b/src/app/tools/embed/customize/[embed]/page.tsx index 550c4c8d0..94fe6320f 100644 --- a/src/app/tools/embed/customize/[embed]/page.tsx +++ b/src/app/tools/embed/customize/[embed]/page.tsx @@ -13,6 +13,10 @@ import { configurations, previews } from '../../configurations'; import { Boolean } from './components/Boolean'; import { Color } from './components/Color'; import { Radius } from './components/Radius'; +import { Size } from './components/Size'; +import { SizeWithout0 } from './components/SizeWithout0'; +import { Slider } from './components/Slider'; +import { Text as TextController } from './components/Text'; export interface EmbedPreviewControllerProps { configKey: string; @@ -71,6 +75,26 @@ export default function Page({ control = ; break; } + + case EmbedItemType.Size: { + control = ; + break; + } + + case EmbedItemType.SizeWithout0: { + control = ; + break; + } + + case EmbedItemType.Slider: { + control = ; + break; + } + + case EmbedItemType.String: { + control = ; + break; + } } return ( @@ -78,7 +102,7 @@ export default function Page({ direction={oneLiner ? undefined : 'column'} gap={oneLiner ? '2' : '1'} justify={oneLiner ? 'between' : undefined} - mb="2" + mb={oneLiner ? '2' : '4'} pb={item.pad ? '6' : undefined} > {capitalize(startCase(configKey as string))}