Files
blitzkit/packages/website/src/components/Embeds/Radius.tsx
T

24 lines
720 B
TypeScript
Raw Normal View History

2025-09-02 16:24:13 -05:00
import { Slider } from "@radix-ui/themes";
import type { EmbedPreviewControllerProps } from "../../pages/[...locale]/embed/[embed]/_index";
import { EmbedState, type RadixRadius } from "../../stores/embedState";
2024-10-26 14:33:04 -05:00
export function Radius({ configKey }: EmbedPreviewControllerProps) {
return (
<Slider
2025-04-21 17:01:32 -05:00
variant="classic"
2024-10-26 14:33:04 -05:00
min={0}
max={5}
value={[
EmbedState.use((state) => {
const radius = state[configKey] as RadixRadius;
2025-09-02 16:24:13 -05:00
return radius === "full" ? 5 : parseInt(radius);
2024-10-26 14:33:04 -05:00
}),
]}
onValueChange={([value]) => {
2025-09-02 16:24:13 -05:00
EmbedState.mutate((draft) => {
draft[configKey] = value === 5 ? "full" : `${value}`;
2024-10-26 14:33:04 -05:00
});
}}
/>
);
}