create-antd-layout 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-antd-layout",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "this is create project for @adminui-dev/antd-layout's template proejct",
5
5
  "keywords": [
6
6
  "create-antd-layout",
@@ -10,7 +10,7 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@adminui-dev/antd-layout": "^1.1.6",
13
+ "@adminui-dev/antd-layout": "^1.1.8",
14
14
  "@ant-design/colors": "^7.2.1",
15
15
  "@ant-design/icons": "^6.1.0",
16
16
  "nprogress": "^0.2.0",
@@ -1,13 +1,10 @@
1
1
  import { Suspense } from 'react'
2
2
  import './App.css'
3
3
  import 'nprogress/nprogress.css';
4
- import nProgress from 'nprogress';
5
4
  import { PageLoading } from '@adminui-dev/antd-layout'
6
5
  import { RouterProvider } from 'react-router'
7
6
  import { routers } from './routes'
8
7
 
9
- nProgress.configure({showSpinner:false})
10
-
11
8
  function App() {
12
9
  return (
13
10
  <>
@@ -1,7 +1,86 @@
1
+ import React from 'react'
2
+ import type { FormProps } from 'antd'
3
+ import { Button, Checkbox, Divider, Flex, Form, Input,theme } from 'antd'
4
+ import { useNavigate } from 'react-router';
5
+
6
+ const {useToken} = theme
7
+
8
+ type FieldType = {
9
+ username?: string;
10
+ password?: string;
11
+ remember?: string;
12
+ };
13
+
14
+
15
+ const boxStyles:React.CSSProperties = {
16
+ minWidth:"180px",
17
+ width:"100%",
18
+ padding:"2rem",
19
+ maxWidth:"450px",
20
+ borderRadius:"1rem"
21
+ }
22
+
23
+ /**
24
+ * This is just a casual demo
25
+ * @returns
26
+ */
1
27
  export default function Login(){
28
+ const {token} = useToken()
29
+ const navigate = useNavigate()
30
+
31
+ const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
32
+ console.log('Success:', values);
33
+ navigate("/")
34
+ }
35
+
36
+ const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => {
37
+ console.log('Failed:', errorInfo);
38
+ }
39
+
2
40
  return (
3
- <div>
4
- <h1>Login</h1>
5
- </div>
41
+ <Flex orientation="vertical" align="center" justify="center" style={{width:"100vw",height:"100vh",padding:"1rem",backgroundColor:token.colorBgLayout}}>
42
+ <Flex orientation="vertical" align="center" justify="center">
43
+ <a href="#"><img src="/vite.svg" style={{width:"60px"}} /></a>
44
+ <h3 style={{marginBlockStart:"0.6rem",marginBlockEnd:"0.1rem"}}>Vite.dev</h3>
45
+ <span style={{marginBlockEnd:"1rem",color:token.colorTextSecondary}}>Log in to the backend</span>
46
+ </Flex>
47
+ <div style={{...boxStyles,backgroundColor:token.colorBgContainer}}>
48
+ <Form
49
+ name="basic"
50
+ layout='vertical'
51
+ initialValues={{ remember: true, layout:"vertical"}}
52
+ onFinish={onFinish}
53
+ onFinishFailed={onFinishFailed}
54
+ autoComplete="off"
55
+ >
56
+ <Form.Item<FieldType>
57
+ label="Username"
58
+ name="username"
59
+ rules={[{ required: true, message: 'Please input your username!' }]}
60
+ >
61
+ <Input />
62
+ </Form.Item>
63
+ <Form.Item<FieldType>
64
+ label="Password"
65
+ name="password"
66
+ rules={[{ required: true, message: 'Please input your password!' }]}
67
+ >
68
+ <Input.Password />
69
+ </Form.Item>
70
+ <Form.Item<FieldType> name="remember" valuePropName="checked" label={null}>
71
+ <Checkbox>Remember me</Checkbox>
72
+ </Form.Item>
73
+ <Form.Item label={null} style={{paddingBlockEnd:"0px",marginBlockEnd:"0px"}}>
74
+ <Button block type="primary" htmlType="submit">
75
+ Sign in
76
+ </Button>
77
+ <Divider>or</Divider>
78
+ <Button block>
79
+ Sign up
80
+ </Button>
81
+ </Form.Item>
82
+ </Form>
83
+ </div>
84
+ </Flex>
6
85
  )
7
86
  }