Merge pull request #67 from bipproduction/ui/login

UI Login
This commit is contained in:
Bagasbanuna02
2024-06-21 10:13:27 +08:00
committed by GitHub
3 changed files with 73 additions and 57 deletions

View File

@@ -24,6 +24,11 @@ import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { PhoneInput } from "react-international-phone"; import { PhoneInput } from "react-international-phone";
import "react-international-phone/style.css"; import "react-international-phone/style.css";
import {
AccentColor,
MainColor,
} from "@/app_modules/component_global/color/color_pallet";
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
export default function Login() { export default function Login() {
const router = useRouter(); const router = useRouter();
@@ -31,15 +36,13 @@ export default function Login() {
const focusTrapRef = useFocusTrap(); const focusTrapRef = useFocusTrap();
const [phone, setPhone] = useState(""); const [phone, setPhone] = useState("");
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [isError, setError] = useState(false);
async function onLogin() { async function onLogin() {
// if (nomor.length < 10)
// return ComponentGlobal_NotifikasiPeringatan("Nomor minimal 10 digit");
// if (nomor.length > 13)
// return ComponentGlobal_NotifikasiPeringatan("Nomor maximal 13 digit");
const nomorHp = phone.substring(1); const nomorHp = phone.substring(1);
// console.log(nomorHp) console.log(nomorHp);
if (nomorHp.length <= 4) return setError(true);
await auth_funLogin(nomorHp).then((res) => { await auth_funLogin(nomorHp).then((res) => {
if (res.status === 200) { if (res.status === 200) {
@@ -79,47 +82,54 @@ export default function Login() {
return ( return (
<> <>
<Stack align="center" justify="center" h={"100vh"}> <Stack
<Center> align="center"
<Stack spacing={"xl"}> justify="center"
<Center h={"100%"}> h={"100vh"}
<Image bg={MainColor.darkblue}
mt={"xl"} spacing={100}
height={130} >
width={130} <Stack align="center" spacing={0}>
alt="logo" <Title order={3} c={MainColor.yellow}>
src={"/aset/logo/logo-hipmi.png"} WELCOME TO
/> </Title>
</Center> <Title c={MainColor.yellow}>HIPMI APPS</Title>
<Stack spacing={0}> </Stack>
<Title order={4}>Selamat Datang di HIPMI App</Title>
<Text fs={"italic"} fz={"sm"}>
Silahkan masukan nomor telepon anda untuk masuk !
</Text>
</Stack>
<PhoneInput <Stack w={300}>
// ref={focusTrapRef} <Center>
inputStyle={{ width: "100%" }} <Text c={"white"}>Nomor telepon</Text>
defaultCountry="id" </Center>
onChange={(val) => { <PhoneInput
setPhone(val); inputStyle={{ width: "100%" }}
}} defaultCountry="id"
/> onChange={(val) => {
setPhone(val);
}}
/>
<Button {isError ? (
radius={"md"} <ComponentGlobal_ErrorInput text="Masukan nomor telepon anda" />
color={"teal"} ) : (
onClick={() => { ""
onLogin(); )}
}}
loading={loading ? true : false} <Button
loaderPosition="center" radius={"md"}
> bg={MainColor.yellow}
LOGIN loading={loading ? true : false}
</Button> loaderPosition="center"
</Stack> c={"black"}
</Center> style={{
borderColor: AccentColor.yellow,
}}
onClick={() => {
onLogin();
}}
>
LOGIN
</Button>
</Stack>
</Stack> </Stack>
</> </>
); );

View File

@@ -1,23 +1,17 @@
"use client"; "use client";
import { MainColor } from "@/app_modules/component_global/color/color_pallet";
import { import {
AspectRatio,
Box,
Center, Center,
Flex,
Image, Image,
Paper, Paper,
Stack, Stack
Text,
Title,
} from "@mantine/core"; } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks"; import { useShallowEffect } from "@mantine/hooks";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react";
export default function SplashScreen({ data }: { data: any }) { export default function SplashScreen({ data }: { data: any }) {
const router = useRouter(); const router = useRouter();
const [val, setVal] = useState(false);
useShallowEffect(() => { useShallowEffect(() => {
if (!data) { if (!data) {
@@ -32,16 +26,16 @@ export default function SplashScreen({ data }: { data: any }) {
}, []); }, []);
return ( return (
<> <>
<Center h={"100vh"}> <Center h={"100vh"} bg={MainColor.darkblue}>
<Stack align="center" justify="center" p={"md"}> <Stack align="center" justify="center" p={"md"}>
{/* <Title c={"#002e59"}>Welcome to</Title> */} {/* <Title c={"#002e59"}>Welcome to</Title> */}
<Paper <Paper
p={{ base: 50, md: 60, lg: 80 }} p={{ base: 20, md: 30, lg: 40 }}
bg={"gray.1"} bg={"gray.1"}
radius={500} radius={"100%"}
shadow="xl" shadow="xl"
> >
<Image alt="" src={"/aset/logo/logo-hipmi.png"} /> <Image height={200} alt="" src={"/aset/logo/logo-hipmi.png"} />
</Paper> </Paper>
</Stack> </Stack>
</Center> </Center>

View File

@@ -0,0 +1,12 @@
export const MainColor = {
black: "#202020",
darkblue: "#001D3D",
yellow: "#FFC300",
};
export const AccentColor = {
blackgray: "#333533",
darkblue: "#002E59",
blue: "#00447D",
yellow: "#FFD60A",
};