create-antd-layout 1.0.0 → 1.0.2

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/bin/index.js CHANGED
@@ -62,6 +62,7 @@ program
62
62
  .version("1.0.0")
63
63
  .argument("<project-directory>", 'Project directory name')
64
64
  .action(async (projectDir) => {
65
+ const projectName = path_1.default.basename(projectDir);
65
66
  const targetDir = path_1.default.resolve(process.cwd(), projectDir);
66
67
  if (fs_extra_1.default.existsSync(targetDir)) {
67
68
  console.error(chalk_1.default.red(`❌ Directory '${projectDir}' already exists.`));
@@ -92,6 +93,12 @@ program
92
93
  console.error(err);
93
94
  process.exit(1);
94
95
  }
96
+ const pkgPath = path_1.default.join(targetDir, 'package.json');
97
+ if (fs_extra_1.default.existsSync(pkgPath)) {
98
+ const pkg = await fs_extra_1.default.readJSON(pkgPath);
99
+ pkg.name = projectName;
100
+ await fs_extra_1.default.writeJSON(pkgPath, pkg, { spaces: 2 });
101
+ }
95
102
  const detected = await detectPackageManager();
96
103
  const pmAnswer = await inquirer_1.default.prompt([
97
104
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-antd-layout",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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.7",
14
14
  "@ant-design/colors": "^7.2.1",
15
15
  "@ant-design/icons": "^6.1.0",
16
16
  "nprogress": "^0.2.0",
@@ -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
  }