Skip to content

Commit

Permalink
Merge branch 'canary' into ducanhgh-fix-hostnames
Browse files Browse the repository at this point in the history
  • Loading branch information
DuCanhGH authored Jul 31, 2023
2 parents 80f1fd9 + a0d1d72 commit 24250b3
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 351 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function Navigation({ navLinks }) {
return (
<>
{navLinks.map((link) => {
const isActive = pathname.startsWith(link.href)
const isActive = pathname === link.href

return (
<Link
Expand Down
11 changes: 0 additions & 11 deletions docs/02-app/02-api-reference/05-next-config-js/headers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,6 @@ If you're deploying to [Vercel](https://vercel.com/docs/concepts/edge-network/he
}
```

### X-XSS-Protection

This header stops pages from loading when they detect reflected cross-site scripting (XSS) attacks. Although this protection is not necessary when sites implement a strong [`Content-Security-Policy`](#content-security-policy) disabling the use of inline JavaScript (`'unsafe-inline'`), it can still provide protection for older web browsers that don't support CSP.

```js
{
key: 'X-XSS-Protection',
value: '1; mode=block'
}
```

### X-Frame-Options

This header indicates whether the site should be allowed to be displayed within an `iframe`. This can prevent against clickjacking attacks. This header has been superseded by CSP's `frame-ancestors` option, which has better support in modern browsers.
Expand Down
22 changes: 22 additions & 0 deletions examples/with-ant-design/app/AntdRegistry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use client'

import React from 'react'
import { useServerInsertedHTML } from 'next/navigation'
import { StyleProvider, createCache, extractStyle } from '@ant-design/cssinjs'

interface StyledRegistryProps {
children: React.ReactNode
}

const StyledComponentsRegistry = ({ children }: StyledRegistryProps) => {
const cache = createCache()
useServerInsertedHTML(() => (
<style
id="antd"
dangerouslySetInnerHTML={{ __html: extractStyle(cache, true) }}
/>
))
return <StyleProvider cache={cache}>{children}</StyleProvider>
}

export default StyledComponentsRegistry
Binary file added examples/with-ant-design/app/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions examples/with-ant-design/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
28 changes: 28 additions & 0 deletions examples/with-ant-design/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import StyledComponentsRegistry from './AntdRegistry'
import './globals.css'

const inter = Inter({ subsets: ['latin'] })

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}

interface RootLayoutProps {
children: React.ReactNode
}

function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en">
<body className={inter.className}>
<StyledComponentsRegistry>{children}</StyledComponentsRegistry>
</body>
</html>
)
}

export default RootLayout
77 changes: 77 additions & 0 deletions examples/with-ant-design/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
'use client'

import React from 'react'
import Link from 'next/link'
import { SmileFilled } from '@ant-design/icons'
import {
Button,
DatePicker,
Form,
InputNumber,
Select,
Slider,
Switch,
ConfigProvider,
} from 'antd'
import theme from './themeConfig'

const HomePage = () => (
<ConfigProvider theme={theme}>
<div style={{ padding: 100, height: '100vh' }}>
<div className="text-center mb-5">
<Link href="#" className="logo mr-0">
<SmileFilled style={{ fontSize: 48 }} />
</Link>
<p className="mb-0 mt-3 text-disabled">Welcome to the world !</p>
</div>
<div>
<Form
layout="horizontal"
size={'large'}
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Form.Item label="Input Number">
<InputNumber
min={1}
max={10}
style={{ width: 100 }}
defaultValue={3}
name="inputNumber"
/>
</Form.Item>
<Form.Item label="Switch">
<Switch defaultChecked />
</Form.Item>
<Form.Item label="Slider">
<Slider defaultValue={70} />
</Form.Item>
<Form.Item label="Select">
<Select
defaultValue="lucy"
style={{ width: 192 }}
options={[
{ value: 'jack', label: 'Jack' },
{ value: 'lucy', label: 'Lucy' },
{ value: 'Yiminghe', label: 'yiminghe' },
{ value: 'lijianan', label: 'lijianan' },
{ value: 'disabled', label: 'Disabled', disabled: true },
]}
/>
</Form.Item>
<Form.Item label="DatePicker">
<DatePicker showTime />
</Form.Item>
<Form.Item style={{ marginTop: 48 }} wrapperCol={{ offset: 8 }}>
<Button type="primary" htmlType="submit">
OK
</Button>
<Button style={{ marginLeft: 8 }}>Cancel</Button>
</Form.Item>
</Form>
</div>
</div>
</ConfigProvider>
)

export default HomePage
10 changes: 10 additions & 0 deletions examples/with-ant-design/app/themeConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { ThemeConfig } from 'antd'

const theme: ThemeConfig = {
token: {
fontSize: 16,
colorPrimary: '#52c41a',
},
}

export default theme
14 changes: 7 additions & 7 deletions examples/with-ant-design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"start": "next start"
},
"dependencies": {
"@ant-design/icons": "^4.8.0",
"@ant-design/icons": "^5.1.4",
"antd": "^5.0.0",
"next": "latest",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "^20.4.5",
"@types/react": "^18.2.17",
"@types/react-dom": "^18.2.7",
"typescript": "^5.1.6"
},
"browser": {
"fs": false,
"path": false
},
"devDependencies": {
"@types/node": "18.0.3",
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6",
"typescript": "4.7.4"
}
}
10 changes: 0 additions & 10 deletions examples/with-ant-design/pages/_app.tsx

This file was deleted.

101 changes: 0 additions & 101 deletions examples/with-ant-design/pages/index.tsx

This file was deleted.

Loading

0 comments on commit 24250b3

Please sign in to comment.