Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 jsx element instead of react node provider #301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/1-bug-report.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug Report
description: File a bug report.
title: "[Bug]: "
labels: ["bug", "triage"]
title: '[Bug]: '
labels: ['bug', 'triage']
body:
- type: markdown
attributes:
Expand All @@ -13,7 +13,7 @@ body:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
value: 'A bug happened!'
validations:
required: true
- type: input
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/2-feature-request.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Feature request
description: Feature request for next-themes.
title: "[Feature request]: "
labels: ["request"]
title: '[Feature request]: '
labels: ['request']
body:
- type: markdown
attributes:
Expand All @@ -12,6 +12,6 @@ body:
attributes:
label: What feature would you like to see?
description: Specify the feature you would like to see and perhaps what problem it would solve for you.
placeholder: "I would like to be able to..."
placeholder: 'I would like to be able to...'
validations:
required: true
2 changes: 1 addition & 1 deletion examples/multi-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"tailwindcss": "3.3.3",
"typescript": "^5.2.2"
}
}
}
4 changes: 2 additions & 2 deletions examples/multi-theme/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
autoprefixer: {}
}
}
1 change: 0 additions & 1 deletion next-themes/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,5 +429,4 @@ describe('setTheme', () => {
expect(result.current.theme).toBe('light')
expect(result.current.resolvedTheme).toBe('light')
})

})
4 changes: 2 additions & 2 deletions next-themes/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const defaultContext: UseThemeProps = { setTheme: _ => {}, themes: [] }

export const useTheme = () => React.useContext(ThemeContext) ?? defaultContext

export const ThemeProvider = (props: ThemeProviderProps): React.ReactNode => {
export const ThemeProvider = (props: ThemeProviderProps): JSX.Element => {
const context = React.useContext(ThemeContext)

// Ignore nested context providers, just passthrough children
if (context) return props.children
if (context) return <>{props.children}</>
return <Theme {...props} />
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"pnpm": ">=9"
},
"packageManager": "pnpm@9.0.6"
}
}
Loading
Loading