Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript to ant design example #38470

Merged
merged 55 commits into from Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
02a99bb
Add nextui example
valcosmos Jun 30, 2022
c573f41
Merge branch 'canary' into canary
valcosmos Jun 30, 2022
bcb9461
Merge branch 'canary' into canary
valcosmos Jun 30, 2022
bf6b58a
Merge branch 'canary' into canary
valcosmos Jul 1, 2022
3f8cb4b
Merge branch 'canary' into canary
valcosmos Jul 2, 2022
c2c4bfc
Merge branch 'canary' into canary
valcosmos Jul 2, 2022
a048de3
Merge branch 'canary' into canary
valcosmos Jul 2, 2022
9074103
Merge branch 'canary' into canary
valcosmos Jul 3, 2022
c31e9b5
Merge branch 'canary' into canary
valcosmos Jul 4, 2022
2e457c3
Merge branch 'canary' into canary
valcosmos Jul 4, 2022
874efd3
Merge branch 'canary' into canary
valcosmos Jul 5, 2022
e086821
Merge branch 'canary' into canary
valcosmos Jul 5, 2022
64d62aa
Merge branch 'canary' into canary
valcosmos Jul 5, 2022
b011ffc
Update index.tsx
valcosmos Jul 5, 2022
ecb19aa
format code with prettier
valcosmos Jul 6, 2022
309ae01
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
e55e04b
Update examples/with-next-ui/package.json
valcosmos Jul 6, 2022
33bc174
Update examples/with-next-ui/package.json
valcosmos Jul 6, 2022
bea4d04
Update examples/with-next-ui/package.json
valcosmos Jul 6, 2022
c846e66
Update examples/with-next-ui/package.json
valcosmos Jul 6, 2022
210e9e2
Apply suggestions from code review
balazsorban44 Jul 6, 2022
4c8560f
Delete hello.ts
balazsorban44 Jul 6, 2022
b6c3915
remove some unrelated file and code
valcosmos Jul 6, 2022
ff095c6
remove some unrelated file and code
valcosmos Jul 6, 2022
dcc2e5a
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
ee82ad8
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
646aa16
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
798651b
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
6620d30
remove some unrelated code
valcosmos Jul 6, 2022
be2c806
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
305e297
Merge branch 'canary' into canary
valcosmos Jul 6, 2022
70e78a4
Merge branch 'canary' into canary
valcosmos Jul 7, 2022
3b3e456
Merge branch 'canary' into canary
valcosmos Jul 8, 2022
911838f
Merge branch 'canary' into canary
valcosmos Jul 8, 2022
7aa5e54
Update examples/with-next-ui/package.json
valcosmos Jul 8, 2022
d8174b9
Update examples/with-next-ui/package.json
valcosmos Jul 8, 2022
18cfc08
Update examples/with-next-ui/package.json
valcosmos Jul 8, 2022
f490b5d
Update next.config.js
valcosmos Jul 8, 2022
6fa427c
Merge branch 'canary' into canary
valcosmos Jul 8, 2022
260527e
Merge branch 'canary' into canary
valcosmos Jul 8, 2022
bb52f98
Merge branch 'canary' into canary
valcosmos Jul 8, 2022
92283e1
Merge branch 'canary' into canary
valcosmos Jul 8, 2022
898fca3
Add TypeScript to the ant-design example
valcosmos Jul 9, 2022
cfdbcf1
Revert "Add TypeScript to the ant-design example"
valcosmos Jul 9, 2022
07e6681
Add TypeScript to the ant-design example
valcosmos Jul 9, 2022
65f05c6
fixed
valcosmos Jul 9, 2022
2145d60
Update package.json
valcosmos Jul 9, 2022
8484117
Merge branch 'canary' into add_TypeScript_to_ant_design
valcosmos Jul 10, 2022
8db6eb7
Merge branch 'canary' into add_TypeScript_to_ant_design
valcosmos Jul 11, 2022
8217be7
Update index.tsx
valcosmos Jul 11, 2022
137e69a
Merge branch 'canary' into add_TypeScript_to_ant_design
valcosmos Jul 11, 2022
f9edd31
Merge branch 'canary' into add_TypeScript_to_ant_design
valcosmos Jul 11, 2022
c17ea1b
Merge branch 'canary' into add_TypeScript_to_ant_design
valcosmos Jul 12, 2022
58acd87
Merge branch 'canary' into add_TypeScript_to_ant_design
valcosmos Jul 19, 2022
ca9b0fb
Merge branch 'canary' into add_TypeScript_to_ant_design
ijjk Aug 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions examples/with-ant-design/components/DatePicker.js

This file was deleted.

5 changes: 5 additions & 0 deletions examples/with-ant-design/next-env.d.ts
@@ -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.
10 changes: 6 additions & 4 deletions examples/with-ant-design/next.config.js
@@ -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
21 changes: 9 additions & 12 deletions examples/with-ant-design/package.json
Expand Up @@ -3,26 +3,23 @@
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"analyze": "cross-env ANALYZE=true next build"
"start": "next start"
},
"dependencies": {
"@ant-design/icons": "4.2.1",
"@next/bundle-analyzer": "^9.1.4",
"antd": "4.3.0",
"cross-env": "^7.0.2",
"dayjs": "1.8.28",
"esm": "^3.2.25",
"@ant-design/icons": "^4.7.0",
"antd": "^4.21.5",
"next": "latest",
"postcss-preset-env": "^6.7.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "18.2.0",
"react-dom": "18.2.0"
},
"browser": {
"fs": false,
"path": false
},
"devDependencies": {
"cross-env": "^7.0.3"
"@types/node": "18.0.3",
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6",
"typescript": "4.7.4"
}
}
@@ -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
ijjk marked this conversation as resolved.
Show resolved Hide resolved
104 changes: 0 additions & 104 deletions examples/with-ant-design/pages/index.js

This file was deleted.

92 changes: 92 additions & 0 deletions examples/with-ant-design/pages/index.tsx
@@ -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 = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NextPage type does not give any value here, let's keep the previous export default function Home format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, I have fixed it.

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
20 changes: 20 additions & 0 deletions examples/with-ant-design/tsconfig.json
@@ -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"]
}