mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-20 04:14:12 +01:00
update embed and fix varuna bug
This commit is contained in:
1 parent
d2041d0ee6
commit
645cfacecb
8 files changed
+81
-69
No files matched your search
@@ -1,8 +1,15 @@
|
||||
import type { TextProps } from '@radix-ui/themes';
|
||||
import { EmbedState, type EmbedConfig, type ExtractEmbedConfigTypes } from '.';
|
||||
import type { EmbedConfigItemType, EmbedItemType } from './constants';
|
||||
import type { TextProps } from "@radix-ui/themes";
|
||||
import { EmbedState, type EmbedConfig, type ExtractEmbedConfigTypes } from ".";
|
||||
import {
|
||||
breakdownConfig,
|
||||
extractEmbedConfigDefaults,
|
||||
} from "../../constants/embeds";
|
||||
import type { EmbedConfigItemType, EmbedItemType } from "./constants";
|
||||
|
||||
export function useEmbedStateCurry<Config extends EmbedConfig>() {
|
||||
// TODO: find a way to initialize with the correct state preset
|
||||
EmbedState.useInitialization(extractEmbedConfigDefaults(breakdownConfig));
|
||||
|
||||
function useEmbedState<Key extends keyof Config>(key: Key) {
|
||||
return EmbedState.use((state) => {
|
||||
return (state as ExtractEmbedConfigTypes<Config>)[key];
|
||||
@@ -18,7 +25,7 @@ export function useEmbedStateCurry<Config extends EmbedConfig>() {
|
||||
>(key: Key) {
|
||||
const { color, ...state } = useEmbedState(
|
||||
key,
|
||||
) as EmbedConfigItemType<EmbedItemType.RichText>['default'];
|
||||
) as EmbedConfigItemType<EmbedItemType.RichText>["default"];
|
||||
|
||||
return {
|
||||
style: { color },
|
||||
|
||||
Reference in new issue
Block a user