Skip to content

Commit

Permalink
🐛 Updated Theme component exports
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Feb 6, 2025
1 parent 11b1e98 commit f269311
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-clouds-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-react": patch
---

Theme: Theme-prop is now optional.
5 changes: 5 additions & 0 deletions @navikt/core/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ export { Switch, type SwitchProps } from "./form/switch";
export { Textarea, type TextareaProps } from "./form/textarea";
export { TextField, type TextFieldProps } from "./form/textfield";

/**
* Theming
*/
export { Theme, type ThemeProps } from "./theme";

/**
* @deprecated
*/
Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/react/src/theme/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type ThemeContext = {
* Color theme
* @default "light"
*/
theme: "light" | "dark";
theme?: "light" | "dark";
};

const [ThemeProvider, useThemeInternal] = createContext<ThemeContext>({
Expand All @@ -18,7 +18,7 @@ const [ThemeProvider, useThemeInternal] = createContext<ThemeContext>({
providerName: "ThemeProvider",
});

type ThemeProps = {
export type ThemeProps = {
className?: string;
hasBackground?: boolean;
} & ThemeContext &
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/react/src/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"use client";
export { Theme } from "./Theme";
export { Theme, ThemeProps } from "./Theme";

0 comments on commit f269311

Please sign in to comment.