Skip to content

Commit

Permalink
Support forcedTheme for dark/light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
calebjacob committed Feb 26, 2025
1 parent d4469fe commit 6ab8f3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-pagoda/ui",
"version": "3.2.1",
"version": "3.2.2",
"description": "A React component library that implements the official NEAR design system.",
"license": "MIT",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/context/PagodaUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ThemeProvider } from 'next-themes';
import { type ComponentProps, createContext, ForwardedRef, type ReactNode, useContext } from 'react';

type PagodaUi = {
forcedTheme?: 'dark' | 'light';
Link: (props: {
children: ReactNode;
className?: string;
Expand All @@ -19,7 +20,7 @@ export const PagodaUiContext = createContext<PagodaUi | null>(null);

export const PagodaUiProvider = ({ value, children }: ComponentProps<typeof PagodaUiContext.Provider>) => {
return (
<ThemeProvider attribute="class">
<ThemeProvider enableSystem={!value?.forcedTheme} forcedTheme={value?.forcedTheme} attribute="class">
<PagodaUiContext.Provider value={value}>{children}</PagodaUiContext.Provider>
</ThemeProvider>
);
Expand Down

0 comments on commit 6ab8f3d

Please sign in to comment.