Skip to content

Commit

Permalink
Add loading effects and other improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Piumal1999 committed Aug 23, 2023
1 parent 71d028a commit 58de51f
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 119 deletions.
35 changes: 29 additions & 6 deletions src/components/ChangePasswordForm/ChangePasswordForm.component.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import React from 'react';
import { Button, Form, Input } from 'antd';
import { Button, Form, Input, message } from 'antd';

Check failure on line 2 in src/components/ChangePasswordForm/ChangePasswordForm.component.tsx

View workflow job for this annotation

GitHub Actions / build

'message' is declared but its value is never read.

const ChangePasswordForm: React.FC = () => {
interface ChangePasswordFormProps {
onSubmit: (props: {
current_password: string;
new_password: string;
confirm_new_password: string;
}) => void;
}

const ChangePasswordForm: React.FC<ChangePasswordFormProps> = ({
onSubmit,
}) => {
return (
<Form
name="basic"
name="change_password"
layout="vertical"
initialValues={{ remember: true }}
wrapperCol={{ span: 14 }}
// onFinish={onFinish}
// onFinishFailed={onFinishFailed}
autoComplete="off"
>
<Form.Item<string>
Expand All @@ -25,16 +33,31 @@ const ChangePasswordForm: React.FC = () => {
<Form.Item<string>
label="New Password"
name="new_password"
rules={[{ required: true, message: 'New Password cannot be empty!' }]}
rules={[
{ required: true, message: 'New Password cannot be empty!' },
{ min: 8, message: 'Password must be at least 8 characters long' },
]}
>
<Input.Password />
</Form.Item>

<Form.Item<string>
label="Confirm New Password"
name="confirm_new_password"
dependencies={['new_password']}
rules={[
{ required: true, message: 'Confirm New Password cannot be empty!' },
({ getFieldValue }) => ({
async validator(_, value: string) {
if (value === '' || getFieldValue('new_password') === value) {
await Promise.resolve();
return;
}
return await Promise.reject(
new Error("The two passwords don't match")
);
},
}),
]}
>
<Input.Password />
Expand Down
Loading

0 comments on commit 58de51f

Please sign in to comment.