Skip to content

Commit

Permalink
Merge pull request #34 from react18-tools/fix-imports
Browse files Browse the repository at this point in the history
Fix imports
  • Loading branch information
mayank1513 committed Jun 23, 2024
2 parents 1c0b28f + d8851eb commit d176afa
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 15 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ interface UseThemeYield {
### Next.js App Router

```tsx
import { ForceTheme } from "nextjs-themes";
import { ForceTheme } from "nextjs-themes/force-theme";

function MyPage() {
return (
Expand All @@ -234,6 +234,8 @@ function MyPage() {
export default MyPage;
```

> If you are using TypeScript and have not set nodeResolution to `Bundler` or `Node16` or `NodeNext`, you need to import from `nextjs-themes/client/force-theme`
### Next.js Pages Router

For the pages router, you have two options. The first option is the same as the app router, and the second option, which is compatible with `next-themes`, involves adding the `theme` property to your page component like this:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ColorSchemeType } from "nextjs-themes";
import { ForceColorScheme } from "nextjs-themes";
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";

interface PageWithForcedColorSchemeProps {
params: { colorScheme: ColorSchemeType };
Expand Down
2 changes: 1 addition & 1 deletion examples/app-router/src/app/forced-color-scheme/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForceColorScheme } from "nextjs-themes";
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";

export default function PageWithForcedColorScheme(): JSX.Element {
return (
Expand Down
2 changes: 1 addition & 1 deletion examples/app-router/src/app/themed-page/[theme]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForceTheme } from "nextjs-themes";
import { ForceTheme } from "nextjs-themes/force-theme";

interface PageProps {
params: { theme: string };
Expand Down
2 changes: 1 addition & 1 deletion examples/app-router/src/app/themed-page/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForceTheme } from "nextjs-themes";
import { ForceTheme } from "nextjs-themes/force-theme";

export default function PageWithForcedTheme(): JSX.Element {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useRouter } from "next/router";
import { ColorSchemeType, ForceColorScheme } from "nextjs-themes";
import { ColorSchemeType } from "nextjs-themes";
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";

export default function PageWithForcedColorScheme() {
const router = useRouter();
Expand Down
2 changes: 1 addition & 1 deletion examples/pages-router/src/pages/themed-page/[theme].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRouter } from "next/router";
import { ForceTheme } from "nextjs-themes";
import { ForceTheme } from "nextjs-themes/force-theme";

export default function PageWithForcedTheme() {
const router = useRouter();
Expand Down
3 changes: 2 additions & 1 deletion examples/vite/src/app/forced-color-scheme-page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { ColorSchemeType, ForceColorScheme } from "nextjs-themes";
import { ColorSchemeType } from "nextjs-themes";
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";
import { Link, useParams } from "react-router-dom";
import { Header } from "@repo/shared";

Expand Down
2 changes: 1 addition & 1 deletion examples/vite/src/app/themed-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Link, useParams } from "react-router-dom";
import { ForceTheme } from "nextjs-themes";
import { ForceTheme } from "nextjs-themes/force-theme";
import { Header } from "@repo/shared";

export default function ThemedPage() {
Expand Down
6 changes: 6 additions & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# nextjs-themes

## 3.1.7

### Patch Changes

- 99a0702: Update exports.

## 3.1.6

### Patch Changes
Expand Down
24 changes: 22 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nextjs-themes",
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
"private": false,
"version": "3.1.6",
"version": "3.1.7",
"description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.",
"license": "MPL-2.0",
"main": "./dist/index.js",
Expand Down Expand Up @@ -46,6 +46,26 @@
"import": "./dist/client/theme-switcher/index.mjs",
"types": "./dist/client/theme-switcher/index.d.ts"
},
"./client/force-color-scheme": {
"require": "./dist/client/force-color-scheme/index.js",
"import": "./dist/client/force-color-scheme/index.mjs",
"types": "./dist/client/force-color-scheme/index.d.ts"
},
"./force-color-scheme": {
"require": "./dist/client/force-color-scheme/index.js",
"import": "./dist/client/force-color-scheme/index.mjs",
"types": "./dist/client/force-color-scheme/index.d.ts"
},
"./client/force-theme": {
"require": "./dist/client/force-theme/index.js",
"import": "./dist/client/force-theme/index.mjs",
"types": "./dist/client/force-theme/index.d.ts"
},
"./force-theme": {
"require": "./dist/client/force-theme/index.js",
"import": "./dist/client/force-theme/index.mjs",
"types": "./dist/client/force-theme/index.d.ts"
},
"./server": {
"require": "./dist/server/index.js",
"import": "./dist/server/index.mjs",
Expand Down Expand Up @@ -104,7 +124,7 @@
"vitest": "^1.6.0"
},
"dependencies": {
"r18gs": "^1.1.3"
"r18gs": "^2.0.0-alpha.0"
},
"peerDependencies": {
"@types/react": "16.8 - 19",
Expand Down
2 changes: 1 addition & 1 deletion lib/src/client/force-theme/force-theme.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cleanup, render } from "@testing-library/react";
import { afterEach, describe, test } from "vitest";
import { DARK, DEFAULT_ID } from "../../constants";
import { DEFAULT_ID } from "../../constants";
import { ThemeSwitcher } from "../theme-switcher";
import { noFOUCScript } from "../theme-switcher/no-fouc";
import { initialState } from "../../store";
Expand Down
7 changes: 7 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @repo/shared

## 0.0.5

### Patch Changes

- Updated dependencies [99a0702]
- [email protected]

## 0.0.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@repo/shared",
"version": "0.0.4",
"version": "0.0.5",
"private": true,
"sideEffects": false,
"main": "./dist/index.js",
Expand Down
21 changes: 19 additions & 2 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 d176afa

Please sign in to comment.