Fix conflict and add disabled button when invalid input (#30)
* feat: responsive * fix: success register * feat: auth login responsive && auth login implementation * fix: login page button disabled & register page * fix: conflict * fix: button disabled when loading
This commit is contained in:
@@ -12,12 +12,13 @@ export const useLogin = () => {
|
|||||||
mode: 'all',
|
mode: 'all',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { signIn } = useSession();
|
const { signIn, isLoading } = useSession();
|
||||||
|
|
||||||
const onSubmit = form.handleSubmit((data) => signIn(data));
|
const onSubmit = form.handleSubmit((data) => signIn(data));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
form,
|
form,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
isLoading
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useLogin } from '../../_hooks/use-login';
|
|||||||
import { ArrowLeftOutlined } from '@ant-design/icons';
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
export const Components: FC = (): ReactElement => {
|
export const Components: FC = (): ReactElement => {
|
||||||
const { form, onSubmit } = useLogin();
|
const { form, onSubmit, isLoading } = useLogin();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center min-h-screen py-[60px] px-[80px]">
|
<div className="flex flex-col justify-center items-center min-h-screen py-[60px] px-[80px]">
|
||||||
@@ -42,7 +42,7 @@ export const Components: FC = (): ReactElement => {
|
|||||||
Lupa Password ?
|
Lupa Password ?
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<Button className="w-full" type='submit'>Enter Isekai</Button>
|
<Button className="w-full" type='submit' disabled={(!form.formState.isValid || isLoading)}>Enter Isekai</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div className="flex my-3 gap-3 justify-center">
|
<div className="flex my-3 gap-3 justify-center">
|
||||||
@@ -74,6 +74,13 @@ export const Components: FC = (): ReactElement => {
|
|||||||
<ArrowLeftOutlined />
|
<ArrowLeftOutlined />
|
||||||
Kembali Ke Homepage
|
Kembali Ke Homepage
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
className='xl:hidden w-full gap-3'
|
||||||
|
variant='secondary'
|
||||||
|
>
|
||||||
|
<ArrowLeftOutlined />
|
||||||
|
Kembali Ke Homepage
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,24 +2,33 @@ import { FC, ReactElement } from 'react';
|
|||||||
import { RegisterResetBanner } from '@imphnen-frontend-service/ui/organisms';
|
import { RegisterResetBanner } from '@imphnen-frontend-service/ui/organisms';
|
||||||
import { Button, Input } from '@imphnen-frontend-service/ui/atoms';
|
import { Button, Input } from '@imphnen-frontend-service/ui/atoms';
|
||||||
import { InputField } from '@imphnen-frontend-service/ui/molecules';
|
import { InputField } from '@imphnen-frontend-service/ui/molecules';
|
||||||
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
export const Components: FC = (): ReactElement => {
|
export const Components: FC = (): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center min-h-screen py-[60px] px-[80px]">
|
<div className="flex flex-col justify-center items-center min-h-screen py-[60px] px-[80px]">
|
||||||
<div className="bg-white min-w-[1120px] min-h-[712px] p-10 rounded-2xl shadow-md flex gap-6">
|
<div className="bg-white xl:min-w-[1130px] min-h-[712px] p-10 rounded-2xl shadow-md flex gap-6">
|
||||||
<RegisterResetBanner />
|
<RegisterResetBanner />
|
||||||
<div className="border-2 border-primary-500/50 w-[696px] rounded-lg py-[32px] px-[48px] flex justify-center">
|
<div className="xl:border-2 xl:border-primary-500/50 xl:w-[726px] rounded-lg py-[32px] px-[48px] flex justify-center">
|
||||||
<div className="w-[704px]">
|
<div className="xl:w-[714px]">
|
||||||
|
<Button
|
||||||
|
className='xl:hidden gap-3'
|
||||||
|
variant='secondary'
|
||||||
|
>
|
||||||
|
<ArrowLeftOutlined />
|
||||||
|
Login
|
||||||
|
</Button>
|
||||||
<h3 className="mt-5 text-3xl font-semibold text-primary-500">
|
<h3 className="mt-5 text-3xl font-semibold text-primary-500">
|
||||||
Register
|
Register
|
||||||
</h3>
|
</h3>
|
||||||
<h5 className="text-primary-500 font-medium">
|
<h5 className="text-primary-500 font-medium">
|
||||||
Yosha~! Saatnya Bergabung dengan Dimentorin
|
Yosha~! Saatnya Bergabung dengan Dimentorin
|
||||||
</h5>
|
</h5>
|
||||||
<div className="grid grid-flow-row-dense my-7 grid-cols-2 gap-2">
|
<div className="grid grid-flow-row-dense my-7 lg:grid-cols-2 gap-2">
|
||||||
<InputField
|
<InputField
|
||||||
label="First Name"
|
label="First Name"
|
||||||
size="lg"
|
size="lg"
|
||||||
|
className="w-full"
|
||||||
placeholder="Nama Depan"
|
placeholder="Nama Depan"
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
@@ -31,6 +40,7 @@ export const Components: FC = (): ReactElement => {
|
|||||||
<InputField
|
<InputField
|
||||||
label="Email"
|
label="Email"
|
||||||
size="lg"
|
size="lg"
|
||||||
|
className="w-full"
|
||||||
placeholder="Contoh : yourname@mail.com"
|
placeholder="Contoh : yourname@mail.com"
|
||||||
/>
|
/>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
@@ -90,7 +100,7 @@ export const Components: FC = (): ReactElement => {
|
|||||||
type="password"
|
type="password"
|
||||||
placeholder="Ulangi password-mu, Senpai~!"
|
placeholder="Ulangi password-mu, Senpai~!"
|
||||||
/>
|
/>
|
||||||
<Button className="w-full mt-2">Linked Start !!!</Button>
|
<Button className="xl:w-full mt-2">Linked Start !!!</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import { ArrowRightOutlined } from '@ant-design/icons';
|
|||||||
export const Components: FC = (): ReactElement => {
|
export const Components: FC = (): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center min-h-screen py-[60px] px-[80px]">
|
<div className="flex flex-col justify-center items-center min-h-screen py-[60px] px-[80px]">
|
||||||
<div className="bg-white min-w-[1220px] min-h-[712px] p-10 rounded-2xl shadow-md flex gap-6">
|
<div className="bg-white xl:min-w-[1220px] min-h-[712px] p-10 rounded-2xl shadow-md flex gap-6">
|
||||||
<RegisterResetBanner />
|
<RegisterResetBanner />
|
||||||
<div className="border-2 border-primary-500/50 w-[696px] rounded-lg py-[32px] px-[48px] flex justify-center bg-primary-50">
|
<div className="border-2 border-primary-500/50 xl:w-[696px] rounded-lg py-[32px] px-[48px] flex justify-center bg-primary-50">
|
||||||
<div className="w-[704px] flex flex-col justify-center items-center">
|
<div className="xl:w-[704px] flex flex-col justify-center items-center">
|
||||||
<h2 className="text-4xl text-primary-500 font-semibold">
|
<h2 className="text-4xl text-primary-500 font-semibold">
|
||||||
Register Successfull
|
Register Successfull
|
||||||
</h2>
|
</h2>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const mappingPublicRoutes = [
|
|||||||
'/',
|
'/',
|
||||||
'/auth/login',
|
'/auth/login',
|
||||||
'/auth/forgot',
|
'/auth/forgot',
|
||||||
|
'/auth/register',
|
||||||
'/auth/new-password',
|
'/auth/new-password',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Generated
+4
-4
@@ -26,7 +26,7 @@
|
|||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-hook-form": "^7.55.0",
|
"react-hook-form": "^7.56.4",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^7.3.0",
|
"react-router-dom": "^7.3.0",
|
||||||
"sharp": "^0.34.1",
|
"sharp": "^0.34.1",
|
||||||
@@ -28019,9 +28019,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-hook-form": {
|
"node_modules/react-hook-form": {
|
||||||
"version": "7.56.1",
|
"version": "7.56.4",
|
||||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.4.tgz",
|
||||||
"integrity": "sha512-qWAVokhSpshhcEuQDSANHx3jiAEFzu2HAaaQIzi/r9FNPm1ioAvuJSD4EuZzWd7Al7nTRKcKPnBKO7sRn+zavQ==",
|
"integrity": "sha512-Rob7Ftz2vyZ/ZGsQZPaRdIefkgOSrQSPXfqBdvOPwJfoGnjwRJUs7EM7Kc1mcoDv3NOtqBzPGbcMB8CGn9CKgw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@
|
|||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-hook-form": "^7.55.0",
|
"react-hook-form": "^7.56.4",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^7.3.0",
|
"react-router-dom": "^7.3.0",
|
||||||
"sharp": "^0.34.1",
|
"sharp": "^0.34.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user