create-nextjs-cms 0.5.76 → 0.5.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/templates/default/components/Navbar.tsx +2 -15
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/components/form/helpers/util.ts +3 -3
- package/templates/default/components/spinner.tsx +11 -0
- package/templates/default/components/theme-toggle.tsx +37 -0
- package/templates/default/package.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nextjs-cms",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.78",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"prettier": "^3.3.3",
|
|
29
29
|
"tsx": "^4.20.6",
|
|
30
30
|
"typescript": "^5.9.2",
|
|
31
|
-
"@lzcms/eslint-config": "0.3.0",
|
|
32
31
|
"@lzcms/prettier-config": "0.1.0",
|
|
32
|
+
"@lzcms/eslint-config": "0.3.0",
|
|
33
33
|
"@lzcms/tsconfig": "0.1.0"
|
|
34
34
|
},
|
|
35
35
|
"prettier": "@lzcms/prettier-config",
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from '@/components/ui/dropdown-menu'
|
|
21
21
|
import { useToast } from '@/components/ui/use-toast'
|
|
22
22
|
import { logout, useSession } from 'nextjs-cms/auth/react'
|
|
23
|
+
import ThemeToggle from './theme-toggle'
|
|
23
24
|
type Props = {
|
|
24
25
|
/**
|
|
25
26
|
* Allows the parent component to modify the state when the
|
|
@@ -104,21 +105,7 @@ export default function Navbar(props: Props) {
|
|
|
104
105
|
</Link>
|
|
105
106
|
</DropdownMenuContent>
|
|
106
107
|
</DropdownMenu>
|
|
107
|
-
<
|
|
108
|
-
onClick={() => {
|
|
109
|
-
setTheme(theme === 'dark' ? 'light' : 'dark')
|
|
110
|
-
}}
|
|
111
|
-
type='button'
|
|
112
|
-
className='text-foreground hover:text-foreground/90 relative rounded-full p-1 focus:outline-hidden'
|
|
113
|
-
>
|
|
114
|
-
<span className='absolute -inset-1.5' />
|
|
115
|
-
<span className='sr-only'>Theme</span>
|
|
116
|
-
{theme === 'dark' ? (
|
|
117
|
-
<SunIcon className='h-6 w-6' aria-hidden='true' />
|
|
118
|
-
) : (
|
|
119
|
-
<MoonIcon className='h-6 w-6' aria-hidden='true' />
|
|
120
|
-
)}
|
|
121
|
-
</button>
|
|
108
|
+
<ThemeToggle />
|
|
122
109
|
{/* Profile dropdown */}
|
|
123
110
|
<DropdownMenu>
|
|
124
111
|
<DropdownMenuTrigger
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let configLastUpdated: number =
|
|
1
|
+
let configLastUpdated: number = 0
|
|
2
2
|
|
|
3
3
|
// Use new Function to bypass next.js dynamic import restriction
|
|
4
4
|
const loadHotReloadFile = async () => {
|
|
@@ -6,9 +6,9 @@ const loadHotReloadFile = async () => {
|
|
|
6
6
|
// This approach completely bypasses next.js dynamic import restriction
|
|
7
7
|
const importFn = new Function('path', 'return import(path)')
|
|
8
8
|
const sectionInfo = await importFn('./_section-hot-reload.js')
|
|
9
|
-
configLastUpdated = sectionInfo?.configLastUpdated ??
|
|
9
|
+
configLastUpdated = sectionInfo?.configLastUpdated ?? 0
|
|
10
10
|
} catch {
|
|
11
|
-
configLastUpdated =
|
|
11
|
+
configLastUpdated = 0
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Loader2Icon } from 'lucide-react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
function Spinner({ className, ...props }: React.ComponentProps<'svg'>) {
|
|
6
|
+
return (
|
|
7
|
+
<Loader2Icon role='status' aria-label='Loading' className={cn('size-4 animate-spin', className)} {...props} />
|
|
8
|
+
)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { Spinner }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
2
|
+
import { useTheme } from 'next-themes'
|
|
3
|
+
import { MoonIcon, SunIcon } from '@radix-ui/react-icons'
|
|
4
|
+
import { Spinner } from './spinner'
|
|
5
|
+
|
|
6
|
+
const ThemeToggle = () => {
|
|
7
|
+
const [mounted, setMounted] = useState(false)
|
|
8
|
+
const { theme, setTheme } = useTheme()
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setMounted(true)
|
|
12
|
+
}, [])
|
|
13
|
+
|
|
14
|
+
if (!mounted) {
|
|
15
|
+
return <Spinner className='size-6' />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
onClick={() => {
|
|
21
|
+
setTheme(theme === 'dark' ? 'light' : 'dark')
|
|
22
|
+
}}
|
|
23
|
+
type='button'
|
|
24
|
+
className='text-foreground hover:text-foreground/90 relative rounded-full p-1 focus:outline-hidden'
|
|
25
|
+
>
|
|
26
|
+
<span className='absolute -inset-1.5' />
|
|
27
|
+
<span className='sr-only'>Theme</span>
|
|
28
|
+
{theme === 'dark' ? (
|
|
29
|
+
<SunIcon className='h-6 w-6' aria-hidden='true' />
|
|
30
|
+
) : (
|
|
31
|
+
<MoonIcon className='h-6 w-6' aria-hidden='true' />
|
|
32
|
+
)}
|
|
33
|
+
</button>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default ThemeToggle
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"nanoid": "^5.1.2",
|
|
65
65
|
"next": "16.1.1",
|
|
66
66
|
"next-themes": "^0.4.6",
|
|
67
|
-
"nextjs-cms": "0.5.
|
|
67
|
+
"nextjs-cms": "0.5.78",
|
|
68
68
|
"plaiceholder": "^3.0.0",
|
|
69
69
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
70
70
|
"qrcode": "^1.5.4",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"eslint-config-prettier": "^10.0.1",
|
|
98
98
|
"eslint-plugin-prettier": "^5.2.3",
|
|
99
99
|
"fs-extra": "^11.3.3",
|
|
100
|
-
"nextjs-cms-kit": "0.5.
|
|
100
|
+
"nextjs-cms-kit": "0.5.78",
|
|
101
101
|
"postcss": "^8.5.1",
|
|
102
102
|
"prettier": "3.5.0",
|
|
103
103
|
"raw-loader": "^4.0.2",
|