import { FontBoldIcon, FontSizeIcon } from '@radix-ui/react-icons'; import { Flex, Slider, Text } from '@radix-ui/themes'; import type { EmbedPreviewControllerProps } from '../../pages/tools/embed/[embed]/_index'; import { EmbedState, type RadixSizeWithout0 } from '../../stores/embedState'; import { radixTextWeights, type EmbedConfigItemType, type EmbedItemType, } from '../../stores/embedState/constants'; import { ColorControllerRaw } from './ColorControllerRaw'; export function RichText({ configKey }: EmbedPreviewControllerProps) { const mutateEmbedState = EmbedState.useMutation(); const state = EmbedState.use( (state) => state[ configKey ] as EmbedConfigItemType['default'], ); return ( { mutateEmbedState((draft) => { ( draft[ configKey ] as EmbedConfigItemType['default'] ).color = value; }); }} /> { mutateEmbedState((draft) => { ( draft[ configKey ] as EmbedConfigItemType['default'] ).size = `${value}` as RadixSizeWithout0; }); }} /> { mutateEmbedState((draft) => { ( draft[ configKey ] as EmbedConfigItemType['default'] ).weight = radixTextWeights[value]; }); }} /> ); }