Skip to content

Commit

Permalink
update with-app-dir example (#266)
Browse files Browse the repository at this point in the history
upd

Co-authored-by: paco <34928425+pacocoursey@users.noreply.github.com>
  • Loading branch information
dimaMachina and pacocoursey committed Mar 13, 2024
1 parent 725983c commit c665793
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ If we didn't distinguish between `theme` and `resolvedTheme`, the UI would show

`resolvedTheme` is then useful for modifying behavior or styles at runtime:

```js
```jsx
const { resolvedTheme } = useTheme()

<div style={{ color: resolvedTheme === 'dark' ? white : black }}>
Expand Down
4 changes: 0 additions & 4 deletions examples/with-app-dir/next.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/with-app-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
"next": "^13.4.19",
"next": "^14.1.3",
"next-themes": "workspace:*",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import { useTheme } from 'next-themes'

function ThemeToggle() {
const { theme, resolvedTheme, setTheme } = useTheme()

export function ThemeToggle() {
const { resolvedTheme, setTheme } = useTheme()
return (
<button
className="mt-16 px-4 py-2 text-white dark:text-black bg-black dark:bg-white font-semibold rounded-md"
Expand All @@ -16,5 +15,3 @@ function ThemeToggle() {
</button>
)
}

export default ThemeToggle
4 changes: 2 additions & 2 deletions examples/with-app-dir/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './globals.css'
import { ThemeProvider } from '../components/ThemeProvider'
import { ThemeProvider } from 'next-themes'

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body className="bg-white dark:bg-black min-h-[100dvh]">
<body className="bg-white dark:bg-black min-h-dvh">
<ThemeProvider attribute="class">{children}</ThemeProvider>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion examples/with-app-dir/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ThemeToggle from '../components/ThemeToggle'
import { ThemeToggle } from './ThemeToggle'

export default function Home() {
return (
Expand Down
13 changes: 0 additions & 13 deletions examples/with-app-dir/src/components/ThemeProvider.tsx

This file was deleted.

7 changes: 3 additions & 4 deletions examples/with-app-dir/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { Config } from 'tailwindcss'

const config: Config = {
export default {
darkMode: 'class',
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
content: ['./src/**/*.{js,ts,jsx,tsx}'],
theme: {},
plugins: []
}
export default config
} satisfies Config
147 changes: 145 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 c665793

Please sign in to comment.