Skip to content

Commit

Permalink
fix: fix the failing build due to theme type mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadshaheer committed Oct 23, 2024
1 parent 8dda8b3 commit 748857c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/theme/src/ThemeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ThemeContextType {
theme: Theme;
setTheme: (theme: Theme) => void;
availableThemes: Theme[];
currentThemeColors: typeof ThemeColors.light;
currentThemeColors: (typeof ThemeColors)[Theme];
}

const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
Expand All @@ -28,7 +28,7 @@ export const ThemeProvider: React.FC<{ children: ReactNode }> = ({
});

const currentThemeColors = useMemo(() => {
return ThemeColors[theme as keyof typeof ThemeColors];
return ThemeColors[theme];
}, [theme]);
const availableThemes: Theme[] = ["light", "dark"];

Expand Down
1 change: 1 addition & 0 deletions packages/theme/tsconfig.node.tsbuildinfo

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/theme/tsconfig.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":["./src/ThemeColor.tsx","./src/ThemeContext.tsx","./src/ThemeSwitcher.tsx","./src/index.tsx"],"version":"5.6.2"}
2 changes: 2 additions & 0 deletions packages/theme/vite.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: import("vite").UserConfig;
export default _default;
23 changes: 23 additions & 0 deletions packages/theme/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
import { resolve } from "path";
export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, "src/index.tsx"),
name: "theme",
fileName: function (format) { return "theme.".concat(format, ".js"); },
},
rollupOptions: {
external: ["react", "react-dom"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
plugins: [react(), dts()],
});
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 748857c

Please sign in to comment.