feat(chapter3): replicate styled Next.js app setup
Add the App Router page group, nested layouts, Tailwind and shadcn styling, shared header components, local fonts and backgrounds, Ant Design demo support, and compatible lint scripts and dependencies.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// src/app/demo/layout.tsx
|
||||
'use client';
|
||||
import { FC, PropsWithChildren } from 'react';
|
||||
|
||||
// src/app/demo/layout.tsx
|
||||
import { px2remTransformer, StyleProvider } from '@ant-design/cssinjs';
|
||||
import { AntdRegistry } from '@ant-design/nextjs-registry';
|
||||
import { App as AntdApp, ConfigProvider, theme } from 'antd';
|
||||
import zhCN from 'antd/locale/zh_CN';
|
||||
|
||||
import $styles from './layout.module.css';
|
||||
|
||||
const px2rem = px2remTransformer();
|
||||
const DemoLayout: FC<PropsWithChildren> = ({ children }) => (
|
||||
<AntdRegistry>
|
||||
<ConfigProvider
|
||||
locale={zhCN}
|
||||
theme={{
|
||||
algorithm: theme.defaultAlgorithm,
|
||||
// 启用css变量
|
||||
cssVar: {},
|
||||
hashed: false,
|
||||
token: {},
|
||||
}}
|
||||
>
|
||||
<AntdApp>
|
||||
<StyleProvider transformers={[px2rem]}>
|
||||
<div className={$styles.layout}>{children}</div>
|
||||
</StyleProvider>
|
||||
</AntdApp>
|
||||
</ConfigProvider>
|
||||
</AntdRegistry>
|
||||
);
|
||||
export default DemoLayout;
|
||||
Reference in New Issue
Block a user