mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-19 11:53:25 +01:00
feat: upgrade rest of them
This commit is contained in:
1 parent
fe4afdcbf0
commit
30e87743fc
63 files changed
+824
-1123
No files matched your search
@@ -1,21 +1,18 @@
|
||||
import { FontBoldIcon, FontSizeIcon } from '@radix-ui/react-icons';
|
||||
import { Flex, Slider, Text } from '@radix-ui/themes';
|
||||
import type { EmbedPreviewControllerProps } from '../../pages/[...locale]/embed/[embed]/_index';
|
||||
import { EmbedState, type RadixSizeWithout0 } from '../../stores/embedState';
|
||||
import { FontBoldIcon, FontSizeIcon } from "@radix-ui/react-icons";
|
||||
import { Flex, Slider, Text } from "@radix-ui/themes";
|
||||
import type { EmbedPreviewControllerProps } from "../../pages/[...locale]/embed/[embed]/_index";
|
||||
import { EmbedState, type RadixSizeWithout0 } from "../../stores/embedState";
|
||||
import {
|
||||
radixTextWeights,
|
||||
type EmbedConfigItemType,
|
||||
type EmbedItemType,
|
||||
} from '../../stores/embedState/constants';
|
||||
import { ColorControllerRaw } from './ColorControllerRaw';
|
||||
} 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<EmbedItemType.RichText>['default'],
|
||||
state[configKey] as EmbedConfigItemType<EmbedItemType.RichText>["default"]
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -24,11 +21,11 @@ export function RichText({ configKey }: EmbedPreviewControllerProps) {
|
||||
<ColorControllerRaw
|
||||
value={state.color}
|
||||
onValueChange={(value) => {
|
||||
mutateEmbedState((draft) => {
|
||||
EmbedState.mutate((draft) => {
|
||||
(
|
||||
draft[
|
||||
configKey
|
||||
] as EmbedConfigItemType<EmbedItemType.RichText>['default']
|
||||
] as EmbedConfigItemType<EmbedItemType.RichText>["default"]
|
||||
).color = value;
|
||||
});
|
||||
}}
|
||||
@@ -45,11 +42,11 @@ export function RichText({ configKey }: EmbedPreviewControllerProps) {
|
||||
max={9}
|
||||
value={[Number(state.size)]}
|
||||
onValueChange={([value]) => {
|
||||
mutateEmbedState((draft) => {
|
||||
EmbedState.mutate((draft) => {
|
||||
(
|
||||
draft[
|
||||
configKey
|
||||
] as EmbedConfigItemType<EmbedItemType.RichText>['default']
|
||||
] as EmbedConfigItemType<EmbedItemType.RichText>["default"]
|
||||
).size = `${value}` as RadixSizeWithout0;
|
||||
});
|
||||
}}
|
||||
@@ -66,11 +63,11 @@ export function RichText({ configKey }: EmbedPreviewControllerProps) {
|
||||
max={radixTextWeights.length - 1}
|
||||
value={[radixTextWeights.indexOf(state.weight)]}
|
||||
onValueChange={([value]) => {
|
||||
mutateEmbedState((draft) => {
|
||||
EmbedState.mutate((draft) => {
|
||||
(
|
||||
draft[
|
||||
configKey
|
||||
] as EmbedConfigItemType<EmbedItemType.RichText>['default']
|
||||
] as EmbedConfigItemType<EmbedItemType.RichText>["default"]
|
||||
).weight = radixTextWeights[value];
|
||||
});
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user