Spaces:
Sleeping
Sleeping
Revert "remove login page"
Browse filesThis reverts commit b78b146c6045b0c76b67fc233e53d452c90c9b26.
- app/(auth)/login/page.tsx +69 -0
- app/(auth)/login/styles.css +26 -0
app/(auth)/login/page.tsx
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
import React from 'react';
|
| 3 |
+
import { Form, Input, Button, Checkbox, Typography, Layout, FormProps } from 'antd';
|
| 4 |
+
import './styles.css';
|
| 5 |
+
import { useRouter } from 'next/navigation';
|
| 6 |
+
|
| 7 |
+
const { Title } = Typography;
|
| 8 |
+
const { Content } = Layout;
|
| 9 |
+
|
| 10 |
+
type FieldType = {
|
| 11 |
+
username?: string;
|
| 12 |
+
password?: string;
|
| 13 |
+
remember?: string;
|
| 14 |
+
};
|
| 15 |
+
|
| 16 |
+
const LoginPage = () => {
|
| 17 |
+
const router = useRouter();
|
| 18 |
+
const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
|
| 19 |
+
console.log('Success:', values);
|
| 20 |
+
router.push('/dashboard');
|
| 21 |
+
};
|
| 22 |
+
|
| 23 |
+
const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => {
|
| 24 |
+
console.log('Failed:', errorInfo);
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
return (
|
| 28 |
+
<Layout className="layout">
|
| 29 |
+
<Content className="content">
|
| 30 |
+
<div className="login-container">
|
| 31 |
+
<Title level={2}>Login</Title>
|
| 32 |
+
<Form
|
| 33 |
+
name="basic"
|
| 34 |
+
initialValues={{ remember: true }}
|
| 35 |
+
onFinish={onFinish}
|
| 36 |
+
onFinishFailed={onFinishFailed}
|
| 37 |
+
autoComplete="off"
|
| 38 |
+
>
|
| 39 |
+
<Form.Item
|
| 40 |
+
name="username"
|
| 41 |
+
rules={[{ required: true, message: 'Please input your username!' }]}
|
| 42 |
+
>
|
| 43 |
+
<Input placeholder="Username" />
|
| 44 |
+
</Form.Item>
|
| 45 |
+
|
| 46 |
+
<Form.Item
|
| 47 |
+
name="password"
|
| 48 |
+
rules={[{ required: true, message: 'Please input your password!' }]}
|
| 49 |
+
>
|
| 50 |
+
<Input.Password placeholder="Password" />
|
| 51 |
+
</Form.Item>
|
| 52 |
+
|
| 53 |
+
<Form.Item name="remember" valuePropName="checked">
|
| 54 |
+
<Checkbox>Remember me</Checkbox>
|
| 55 |
+
</Form.Item>
|
| 56 |
+
|
| 57 |
+
<Form.Item>
|
| 58 |
+
<Button type="primary" htmlType="submit" block>
|
| 59 |
+
Log in
|
| 60 |
+
</Button>
|
| 61 |
+
</Form.Item>
|
| 62 |
+
</Form>
|
| 63 |
+
</div>
|
| 64 |
+
</Content>
|
| 65 |
+
</Layout>
|
| 66 |
+
);
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
export default LoginPage;
|
app/(auth)/login/styles.css
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.layout {
|
| 2 |
+
min-height: 100vh;
|
| 3 |
+
display: flex;
|
| 4 |
+
justify-content: center;
|
| 5 |
+
align-items: center;
|
| 6 |
+
background-color: #f0f2f5; /* Optional: Change the background color as needed */
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
.content {
|
| 10 |
+
width: 100%;
|
| 11 |
+
max-height: 450px;
|
| 12 |
+
max-width: 400px;
|
| 13 |
+
padding: 24px;
|
| 14 |
+
background: white;
|
| 15 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 16 |
+
border-radius: 8px; /* Optional: Add border radius for rounded corners */
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.login-container {
|
| 20 |
+
width: 100%;
|
| 21 |
+
text-align: center;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.login-container .ant-typography {
|
| 25 |
+
margin-bottom: 24px;
|
| 26 |
+
}
|