From ecf576ab14dbd5a75328cfc60b3db21f55cbd562 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Fri, 20 Dec 2024 09:55:07 +0900 Subject: [PATCH] Remove wrong controller theme context --- packages/keychain/.gitignore | 2 ++ packages/keychain/.storybook/provider.tsx | 4 ++-- packages/keychain/src/context/theme.tsx | 6 +++++- packages/keychain/src/hooks/theme.tsx | 16 ++++++---------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/keychain/.gitignore b/packages/keychain/.gitignore index e9cf4bd77..d0ecd75ad 100644 --- a/packages/keychain/.gitignore +++ b/packages/keychain/.gitignore @@ -24,3 +24,5 @@ dist-ssr *.sw? stats.html .vercel + +storybook-static/ diff --git a/packages/keychain/.storybook/provider.tsx b/packages/keychain/.storybook/provider.tsx index 06adf9c3b..5aa3d17b7 100644 --- a/packages/keychain/.storybook/provider.tsx +++ b/packages/keychain/.storybook/provider.tsx @@ -51,10 +51,10 @@ function ControllerThemeProvider({ theme = defaultTheme, }: PropsWithChildren<{ theme?: ControllerTheme }>) { useThemeEffect({ theme, assetUrl: "" }); - const chakraTheme = useChakraTheme(theme); + const chakraTheme = useChakraTheme({ ...theme, verified: false }); return ( - + {children} ); diff --git a/packages/keychain/src/context/theme.tsx b/packages/keychain/src/context/theme.tsx index ce895ab8f..9e4d50f19 100644 --- a/packages/keychain/src/context/theme.tsx +++ b/packages/keychain/src/context/theme.tsx @@ -1,6 +1,10 @@ import { ControllerTheme } from "@cartridge/presets"; import { createContext } from "react"; +export type VerifiableControllerTheme = ControllerTheme & { + verified: boolean; +}; + export const ControllerThemeContext = createContext< - ControllerTheme | undefined + VerifiableControllerTheme | undefined >(undefined); diff --git a/packages/keychain/src/hooks/theme.tsx b/packages/keychain/src/hooks/theme.tsx index cf831ac3e..d216a50a9 100644 --- a/packages/keychain/src/hooks/theme.tsx +++ b/packages/keychain/src/hooks/theme.tsx @@ -1,14 +1,10 @@ -import { ControllerColor, ControllerTheme } from "@cartridge/presets"; +import { + ControllerThemeContext, + VerifiableControllerTheme, +} from "@/context/theme"; +import { ControllerColor } from "@cartridge/presets"; import { CartridgeTheme } from "@cartridge/ui"; -import { useContext, createContext, useMemo } from "react"; - -export type VerifiableControllerTheme = ControllerTheme & { - verified: boolean; -}; - -export const ControllerThemeContext = createContext< - VerifiableControllerTheme | undefined ->(undefined); +import { useContext, useMemo } from "react"; export function useControllerTheme() { const ctx = useContext(