Skip to content

Commit

Permalink
Remove wrong controller theme context
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed Dec 23, 2024
1 parent 1a06636 commit 8ae4123
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions packages/keychain/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ dist-ssr
*.sw?
stats.html
.vercel

storybook-static/
4 changes: 2 additions & 2 deletions packages/keychain/.storybook/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<ControllerThemeContext.Provider value={theme}>
<ControllerThemeContext.Provider value={{ ...theme, verified: false }}>
<ChakraProvider theme={chakraTheme}>{children}</ChakraProvider>
</ControllerThemeContext.Provider>
);
Expand Down
6 changes: 5 additions & 1 deletion packages/keychain/src/context/theme.tsx
Original file line number Diff line number Diff line change
@@ -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);
16 changes: 6 additions & 10 deletions packages/keychain/src/hooks/theme.tsx
Original file line number Diff line number Diff line change
@@ -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<VerifiableControllerTheme | undefined>(
Expand Down

0 comments on commit 8ae4123

Please sign in to comment.