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 20, 2024
1 parent 33d9fa9 commit 0caada6
Show file tree
Hide file tree
Showing 5 changed files with 20 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
5 changes: 5 additions & 0 deletions packages/keychain/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
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 0caada6

Please sign in to comment.