Skip to content

Commit f140a71

Browse files
committed
opt code
1 parent 453c411 commit f140a71

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

src/components/tools/PasswordGenerator.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default function PasswordGenerator() {
5656
punctuation: true,
5757
capital: true,
5858
}}
59+
style={{ marginLeft: 10, marginRight: 10, marginTop: 40 }}
5960
onFinish={onGeneratePassword}>
6061
<Form.Item
6162
name="password"
@@ -72,7 +73,10 @@ export default function PasswordGenerator() {
7273
{ required: true, message: '请输入区分代码' },
7374
{ min: 3, message: '区分代码过短!' },
7475
]}>
75-
<Input allowClear placeholder="建议使用网站名,比如weixin,taobao,zhihu" />
76+
<Input
77+
allowClear
78+
placeholder="建议使用网站名,比如weixin,taobao,zhihu"
79+
/>
7680
</Form.Item>
7781
<Flex gap="large">
7882
<Form.Item name="length" label="密码长度">
@@ -107,7 +111,7 @@ export default function PasswordGenerator() {
107111
<Input value={password} placeholder="请点击生成密码按钮" />
108112
<Button
109113
type="primary"
110-
style={{ backgroundColor: '#00b4f4' }}
114+
style={{ backgroundColor: '#3498db' }}
111115
onClick={copyPassword}>
112116
复制密码
113117
</Button>

src/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ code {
1414

1515
.form-container {
1616
width: 100%;
17-
max-width: 500px;
17+
max-width: 600px;
1818
margin: 0 auto;
1919
}
2020

2121
@media (min-width: 768px) {
2222
.form-container {
23-
width: 500px;
23+
width: 600px;
2424
}
2525
}

src/pages/ToolsLayout.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import {
33
ClockCircleOutlined,
44
DiffOutlined,
@@ -35,11 +35,6 @@ const topItems: MenuItem[] = [
3535
label: '加密/解密',
3636
icon: <LockOutlined />,
3737
},
38-
{
39-
key: 'password',
40-
label: '密码生成器',
41-
icon: <LockOutlined />,
42-
},
4338
{
4439
key: 'json',
4540
label: 'JSON',
@@ -59,6 +54,10 @@ const ToolsLayout: React.FC = () => {
5954

6055
const navigate = useNavigate();
6156

57+
useEffect(() => {
58+
navigate('timestamp');
59+
}, []);
60+
6261
const onClickMenu: MenuProps['onClick'] = e => {
6362
console.log('click ', e);
6463
// const path = e.keyPath.reverse().join('/')
@@ -71,7 +70,7 @@ const ToolsLayout: React.FC = () => {
7170
<Menu
7271
theme="light"
7372
mode="horizontal"
74-
defaultSelectedKeys={['2']}
73+
defaultSelectedKeys={['timestamp']}
7574
style={{ flex: 1, minWidth: 0 }}
7675
items={topItems}
7776
onClick={onClickMenu}

src/router/Router.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ const router = createBrowserRouter([
1919
path: 'home',
2020
element: <Homepage />,
2121
},
22+
{
23+
path: 'tools/password',
24+
element: <PasswordGenerator />,
25+
},
2226
{
2327
path: 'tools',
2428
element: <ToolsLayout />,
@@ -43,10 +47,6 @@ const router = createBrowserRouter([
4347
path: 'encryption',
4448
element: <EncryptionTabs />,
4549
},
46-
{
47-
path: 'password',
48-
element: <PasswordGenerator />,
49-
},
5050
{
5151
path: 'qrcode',
5252
element: <QRCodeGenerator />,

0 commit comments

Comments
 (0)