forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TypeScript to the ant-design example
- Loading branch information
Showing
8 changed files
with
137 additions
and
136 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const withBundleAnalyzer = require('@next/bundle-analyzer')({ | ||
enabled: process.env.ANALYZE === 'true', | ||
}) | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
} | ||
|
||
module.exports = withBundleAnalyzer() | ||
module.exports = nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
examples/with-ant-design/pages/_app.js → examples/with-ant-design/pages/_app.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import type { AppProps } from 'next/app' | ||
import 'antd/dist/antd.css' | ||
import '../styles/vars.css' | ||
import '../styles/global.css' | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
function MyApp({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} /> | ||
} | ||
|
||
export default MyApp |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { | ||
Button, | ||
DatePicker, | ||
Form, | ||
InputNumber, | ||
Select, | ||
Slider, | ||
Switch, | ||
} from 'antd' | ||
import type { DatePickerProps } from 'antd' | ||
import { SmileFilled } from '@ant-design/icons' | ||
import type { NextPage } from 'next' | ||
import Link from 'next/link' | ||
|
||
const FormItem = Form.Item | ||
const Option = Select.Option | ||
|
||
const content = { | ||
marginTop: '100px', | ||
} | ||
|
||
const Home: NextPage = () => { | ||
const onDatePickerChange: DatePickerProps['onChange'] = ( | ||
date, | ||
dateString | ||
) => { | ||
console.log(date, dateString) | ||
} | ||
|
||
return ( | ||
<div style={content}> | ||
<div className="text-center mb-5"> | ||
<Link href="#"> | ||
<a className="logo mr-0"> | ||
<SmileFilled style={{ fontSize: 48 }} /> | ||
</a> | ||
</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 }} | ||
> | ||
<FormItem label="Input Number"> | ||
<InputNumber | ||
min={1} | ||
max={10} | ||
style={{ width: 100 }} | ||
defaultValue={3} | ||
name="inputNumber" | ||
/> | ||
</FormItem> | ||
|
||
<FormItem label="Switch"> | ||
<Switch defaultChecked /> | ||
</FormItem> | ||
|
||
<FormItem label="Slider"> | ||
<Slider defaultValue={70} /> | ||
</FormItem> | ||
|
||
<FormItem label="Select"> | ||
<Select defaultValue="lucy" style={{ width: 192 }}> | ||
<Option value="jack">jack</Option> | ||
<Option value="lucy">lucy</Option> | ||
<Option value="disabled" disabled> | ||
disabled | ||
</Option> | ||
<Option value="yiminghe">yiminghe</Option> | ||
</Select> | ||
</FormItem> | ||
|
||
<FormItem label="DatePicker"> | ||
<DatePicker showTime onChange={onDatePickerChange} /> | ||
</FormItem> | ||
<FormItem style={{ marginTop: 48 }} wrapperCol={{ offset: 8 }}> | ||
<Button type="primary" htmlType="submit"> | ||
OK | ||
</Button> | ||
<Button style={{ marginLeft: 8 }}>Cancel</Button> | ||
</FormItem> | ||
</Form> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |