create-nextblock 0.2.43 → 0.2.45
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 +1 -1
- package/templates/nextblock-template/app/[slug]/page.tsx +2 -21
- package/templates/nextblock-template/app/providers.tsx +1 -0
- package/templates/nextblock-template/components/blocks/renderers/ClientTextBlockRenderer.tsx +5 -0
- package/templates/nextblock-template/components/theme-switcher.tsx +17 -5
- package/templates/nextblock-template/next-env.d.ts +1 -1
- package/templates/nextblock-template/package.json +1 -1
- package/templates/nextblock-template/tailwind.config.js +3 -5
- package/templates/nextblock-template/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ import type { Metadata } from 'next';
|
|
|
6
6
|
import PageClientContent from "./PageClientContent";
|
|
7
7
|
import { getPageDataBySlug } from "./page.utils";
|
|
8
8
|
import BlockRenderer from "../../components/BlockRenderer";
|
|
9
|
-
import type { HeroBlockContent } from '../../lib/blocks/blockRegistry';
|
|
10
9
|
import { cookies, headers } from "next/headers";
|
|
11
10
|
|
|
12
11
|
export const dynamicParams = true;
|
|
@@ -147,31 +146,13 @@ export default async function DynamicPage({ params: paramsPromise }: PageProps)
|
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
const r2BaseUrl = process.env.NEXT_PUBLIC_R2_BASE_URL || "";
|
|
152
|
-
|
|
153
|
-
if (pageData && pageData.blocks && r2BaseUrl) {
|
|
154
|
-
const heroBlock = pageData.blocks.find(block => block.block_type === 'hero');
|
|
155
|
-
if (heroBlock) {
|
|
156
|
-
const heroContent = heroBlock.content as unknown as HeroBlockContent;
|
|
157
|
-
if (
|
|
158
|
-
heroContent.background &&
|
|
159
|
-
heroContent.background.type === "image" &&
|
|
160
|
-
heroContent.background.image &&
|
|
161
|
-
heroContent.background.image.object_key
|
|
162
|
-
) {
|
|
163
|
-
lcpImageUrl = `${r2BaseUrl}/${heroContent.background.image.object_key}`;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
149
|
+
|
|
167
150
|
|
|
168
151
|
const pageBlocks = pageData ? <BlockRenderer blocks={pageData.blocks} languageId={pageData.language_id} /> : null;
|
|
169
152
|
|
|
170
153
|
return (
|
|
171
154
|
<>
|
|
172
|
-
|
|
173
|
-
<link rel="preload" as="image" href={lcpImageUrl} />
|
|
174
|
-
)}
|
|
155
|
+
|
|
175
156
|
<PageClientContent initialPageData={pageData} currentSlug={params.slug} translatedSlugs={translatedSlugs}>
|
|
176
157
|
{pageBlocks}
|
|
177
158
|
</PageClientContent>
|
package/templates/nextblock-template/components/blocks/renderers/ClientTextBlockRenderer.tsx
CHANGED
|
@@ -16,6 +16,11 @@ const ClientTextBlockRenderer: React.FC<ClientTextBlockRendererProps> = ({ conte
|
|
|
16
16
|
const options: HTMLReactParserOptions = {
|
|
17
17
|
replace: (domNode) => {
|
|
18
18
|
if (domNode instanceof Element && domNode.attribs) {
|
|
19
|
+
if (domNode.attribs['fetchpriority']) {
|
|
20
|
+
domNode.attribs['fetchPriority'] = domNode.attribs['fetchpriority'];
|
|
21
|
+
delete domNode.attribs['fetchpriority'];
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
if (domNode.attribs['data-alert-widget'] !== undefined) {
|
|
20
25
|
const {
|
|
21
26
|
'data-type': type,
|
|
@@ -8,13 +8,15 @@ import {
|
|
|
8
8
|
DropdownMenuRadioItem,
|
|
9
9
|
DropdownMenuTrigger,
|
|
10
10
|
} from "@nextblock-cms/ui";
|
|
11
|
-
import { Laptop, Moon, Sun } from "lucide-react";
|
|
11
|
+
import { Laptop, Moon, Sun, Zap } from "lucide-react";
|
|
12
12
|
import { useTheme } from "next-themes";
|
|
13
13
|
import { useEffect, useState } from "react";
|
|
14
|
+
import { useTranslations } from "@nextblock-cms/utils";
|
|
14
15
|
|
|
15
16
|
const ThemeSwitcher = () => {
|
|
16
17
|
const [mounted, setMounted] = useState(false);
|
|
17
18
|
const { theme, setTheme } = useTheme();
|
|
19
|
+
const { t } = useTranslations();
|
|
18
20
|
|
|
19
21
|
// useEffect only runs on the client, so now we can safely show the UI
|
|
20
22
|
useEffect(() => {
|
|
@@ -30,7 +32,7 @@ const ThemeSwitcher = () => {
|
|
|
30
32
|
return (
|
|
31
33
|
<DropdownMenu>
|
|
32
34
|
<DropdownMenuTrigger asChild>
|
|
33
|
-
<Button variant="ghost" size={"sm"} aria-label=
|
|
35
|
+
<Button variant="ghost" size={"sm"} aria-label={t('theme_switcher')}>
|
|
34
36
|
{theme === "light" ? (
|
|
35
37
|
<Sun
|
|
36
38
|
key="light"
|
|
@@ -43,6 +45,12 @@ const ThemeSwitcher = () => {
|
|
|
43
45
|
size={ICON_SIZE}
|
|
44
46
|
className={"text-muted-foreground"}
|
|
45
47
|
/>
|
|
48
|
+
) : theme === "vibrant" ? (
|
|
49
|
+
<Zap
|
|
50
|
+
key="vibrant"
|
|
51
|
+
size={ICON_SIZE}
|
|
52
|
+
className={"text-muted-foreground"}
|
|
53
|
+
/>
|
|
46
54
|
) : (
|
|
47
55
|
<Laptop
|
|
48
56
|
key="system"
|
|
@@ -59,15 +67,19 @@ const ThemeSwitcher = () => {
|
|
|
59
67
|
>
|
|
60
68
|
<DropdownMenuRadioItem className="flex gap-2" value="light">
|
|
61
69
|
<Sun size={ICON_SIZE} className="text-muted-foreground" />{" "}
|
|
62
|
-
<span>
|
|
70
|
+
<span>{t('theme_light')}</span>
|
|
63
71
|
</DropdownMenuRadioItem>
|
|
64
72
|
<DropdownMenuRadioItem className="flex gap-2" value="dark">
|
|
65
73
|
<Moon size={ICON_SIZE} className="text-muted-foreground" />{" "}
|
|
66
|
-
<span>
|
|
74
|
+
<span>{t('theme_dark')}</span>
|
|
75
|
+
</DropdownMenuRadioItem>
|
|
76
|
+
<DropdownMenuRadioItem className="flex gap-2" value="vibrant">
|
|
77
|
+
<Zap size={ICON_SIZE} className="text-muted-foreground" />{" "}
|
|
78
|
+
<span>{t('theme_vibrant')}</span>
|
|
67
79
|
</DropdownMenuRadioItem>
|
|
68
80
|
<DropdownMenuRadioItem className="flex gap-2" value="system">
|
|
69
81
|
<Laptop size={ICON_SIZE} className="text-muted-foreground" />{" "}
|
|
70
|
-
<span>
|
|
82
|
+
<span>{t('theme_system')}</span>
|
|
71
83
|
</DropdownMenuRadioItem>
|
|
72
84
|
</DropdownMenuRadioGroup>
|
|
73
85
|
</DropdownMenuContent>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="next" />
|
|
2
2
|
/// <reference types="next/image-types/global" />
|
|
3
|
-
import "./.next/types/routes.d.ts";
|
|
3
|
+
import "./.next/dev/types/routes.d.ts";
|
|
4
4
|
|
|
5
5
|
// NOTE: This file should not be edited
|
|
6
6
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
@@ -3,19 +3,17 @@ const { join } = require('path');
|
|
|
3
3
|
|
|
4
4
|
/** @type {import('tailwindcss').Config} */
|
|
5
5
|
module.exports = {
|
|
6
|
-
presets: [require('../../tailwind.config.js')],
|
|
6
|
+
presets: [require('../../libs/ui/tailwind.config.js')],
|
|
7
7
|
content: (() => {
|
|
8
8
|
const projectGlobs = [
|
|
9
9
|
join(
|
|
10
10
|
__dirname,
|
|
11
|
-
'{src,pages,components,app,lib}/**/*!(*.stories|*.spec).{ts,tsx,js,jsx,md,mdx,html}'
|
|
11
|
+
'{src,pages,components,app,lib}/**/*!(*.stories|*.spec).{ts,tsx,js,jsx,md,mdx,html}',
|
|
12
12
|
),
|
|
13
13
|
];
|
|
14
14
|
const libsDir = join(__dirname, '../../libs');
|
|
15
15
|
if (existsSync(libsDir)) {
|
|
16
|
-
projectGlobs.push(
|
|
17
|
-
join(libsDir, '**/*.{ts,tsx,js,jsx,md,mdx,html,sql}')
|
|
18
|
-
);
|
|
16
|
+
projectGlobs.push(join(libsDir, '**/*.{ts,tsx,js,jsx,md,mdx,html,sql}'));
|
|
19
17
|
}
|
|
20
18
|
return projectGlobs;
|
|
21
19
|
})(),
|