-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c9bbd8
commit d0f02a4
Showing
16 changed files
with
156 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
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
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,62 @@ | ||
import React, { FunctionComponent, useCallback } from "react"; | ||
|
||
import { Form, Input, Button, Checkbox } from "antd"; | ||
|
||
interface ILoginFormProps {} | ||
|
||
const layout = { | ||
labelCol: { span: 6 }, | ||
wrapperCol: { span: 18 }, | ||
}; | ||
|
||
const tailLayout = { | ||
wrapperCol: { offset: 6, span: 18 }, | ||
}; | ||
|
||
const LoginForm: FunctionComponent<ILoginFormProps> = (props) => { | ||
const onFinish = useCallback((values: any) => { | ||
console.log("Success:", values); | ||
}, []); | ||
|
||
const onFinishFailed = useCallback((errorInfo: any) => { | ||
console.log("Failed:", errorInfo); | ||
}, []); | ||
|
||
return ( | ||
<Form | ||
{...layout} | ||
name="basic" | ||
initialValues={{ remember: true }} | ||
onFinish={onFinish} | ||
onFinishFailed={onFinishFailed} | ||
> | ||
<Form.Item | ||
label="Username" | ||
name="username" | ||
rules={[{ required: true, message: "Please input your username!" }]} | ||
> | ||
<Input /> | ||
</Form.Item> | ||
|
||
<Form.Item | ||
label="Password" | ||
name="password" | ||
rules={[{ required: true, message: "Please input your password!" }]} | ||
> | ||
<Input.Password /> | ||
</Form.Item> | ||
|
||
<Form.Item {...tailLayout} name="remember" valuePropName="checked"> | ||
<Checkbox>Remember me</Checkbox> | ||
</Form.Item> | ||
|
||
<Form.Item {...tailLayout}> | ||
<Button type="primary" htmlType="submit"> | ||
Submit | ||
</Button> | ||
</Form.Item> | ||
</Form> | ||
); | ||
}; | ||
|
||
export default LoginForm; |
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,2 @@ | ||
import LoginForm from './LoginForm' | ||
export default LoginForm |
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,11 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import LoginForm from 'components/LoginForm'; | ||
|
||
interface ILoginProps { | ||
} | ||
|
||
const Login: FunctionComponent<ILoginProps> = (props) => { | ||
return <LoginForm />; | ||
}; | ||
|
||
export default Login; |
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,2 @@ | ||
import Login from './Login' | ||
export default Login |
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 @@ | ||
export { default as routerMeta } from './routerMeta' |
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,11 @@ | ||
import { RouteProps } from "react-router" | ||
|
||
export type RouterMetaType = { [key: string] : (string | Omit<RouteProps, 'component'>) } | ||
|
||
const routerMeta: RouterMetaType = { | ||
Home: { path: '/', exact: true }, | ||
About: '/about', | ||
Login: '/login' | ||
} | ||
|
||
export default routerMeta |
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,3 @@ | ||
const assignRouteProps = (props: any) => typeof props === 'object' ? props : ({ path: props }) | ||
|
||
export default assignRouteProps |
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,2 @@ | ||
import assignRouteProps from './assignRouteProps' | ||
export default assignRouteProps |
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,2 @@ | ||
export { default as assignRouteProps } from './assignRouteProps' | ||
export { default as range } from './range' |
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,2 @@ | ||
import range from './range' | ||
export default range |
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 @@ | ||
const range = (x: number, y: number) => Array.from((function *() { | ||
while (x <= y) yield x++; | ||
})()); | ||
|
||
export default range |
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