update : profile
Deskripsi: - menghapus info - mengganti variable global menjadi usestate - mengganti layoutnavbar new No Issues
This commit is contained in:
@@ -11,7 +11,7 @@ function LayoutIconBack({ back }: { back?: string }) {
|
||||
return (
|
||||
<Box>
|
||||
<ActionIcon variant="light" onClick={() => {
|
||||
if (!_.isUndefined(back) && !_.isNull(back)) {
|
||||
if (!_.isUndefined(back) && !_.isNull(back) && !_.isEmpty(back)) {
|
||||
return router.push(back)
|
||||
} else {
|
||||
return router.back()
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Button, Flex, Modal, Text } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { BsQuestionCircleFill } from 'react-icons/bs';
|
||||
import { isModal } from '../val/isModal';
|
||||
|
||||
export default function LayoutModal({ opened, onClose, description, onYes }: { opened: boolean, onClose: () => void, description: string, onYes: (val: boolean) => void }) {
|
||||
const openModal = useHookstate(isModal)
|
||||
const [isValModal, setValModal] = useState(opened)
|
||||
return (
|
||||
<Modal styles={{
|
||||
body: {
|
||||
@@ -21,7 +22,7 @@ export default function LayoutModal({ opened, onClose, description, onYes }: { o
|
||||
<Text mt={30} ta={"center"} fw={"bold"} fz={18}>{description}</Text>
|
||||
<Box mt={30} w={'100%'}>
|
||||
<Button mb={20} fullWidth size="lg" radius={'xl'} bg={'#4754F0'} onClick={() => onYes(true)}>YA</Button>
|
||||
<Button fullWidth size="lg" radius={'xl'} bg={'#DCE1FE'} c={'#4754F0'} onClick={() => openModal.set(false)}>TIDAK</Button>
|
||||
<Button fullWidth size="lg" radius={'xl'} bg={'#DCE1FE'} c={'#4754F0'} onClick={() => onYes(false)}>TIDAK</Button>
|
||||
</Box>
|
||||
</Flex>
|
||||
</Modal>
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
"use client"
|
||||
import { isModal, WARNA } from "@/module/_global";
|
||||
import { LayoutNavbarNew, WARNA } from "@/module/_global";
|
||||
import { Box, Button, Flex, Modal, Stack, Text, TextInput } from "@mantine/core";
|
||||
import HeaderEditProfile from "../component/ui/header_edit_profile";
|
||||
import { HiUser } from "react-icons/hi2";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { BsQuestionCircleFill } from "react-icons/bs"
|
||||
import toast from "react-hot-toast";
|
||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function EditProfile() {
|
||||
const openModal = useHookstate(isModal)
|
||||
const [isValModal, setValModal] = useState(false)
|
||||
|
||||
function onTrue() {
|
||||
toast.success("Sukses! Data tersimpan");
|
||||
openModal.set(false)
|
||||
function onTrue(val: boolean) {
|
||||
if (val) {
|
||||
toast.success("Sukses! Data tersimpan");
|
||||
}
|
||||
setValModal(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<HeaderEditProfile />
|
||||
<LayoutNavbarNew back='' title='Edit Profil' menu='' />
|
||||
<Stack
|
||||
align="center"
|
||||
justify="center"
|
||||
@@ -79,15 +80,15 @@ export default function EditProfile() {
|
||||
size="md"
|
||||
radius={30}
|
||||
fullWidth
|
||||
onClick={() => openModal.set(true)}
|
||||
onClick={() => setValModal(true)}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Box>
|
||||
<LayoutModal opened={openModal.get()} onClose={() => openModal.set(false)}
|
||||
description="Apakah Anda Ingin Mengganti
|
||||
Status Aktivasi Data?"
|
||||
onYes={onTrue} />
|
||||
<LayoutModal opened={isValModal} onClose={() => setValModal(false)}
|
||||
description="Apakah Anda yakin ingin
|
||||
melakukan perubahan data?"
|
||||
onYes={(val) => { onTrue(val) }} />
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
'use client'
|
||||
import { LayoutIconBack, LayoutNavbarHome } from '@/module/_global';
|
||||
import { LayoutIconBack, LayoutNavbarHome, LayoutNavbarNew } from '@/module/_global';
|
||||
import { Box, Grid, Text } from '@mantine/core';
|
||||
import React from 'react';
|
||||
|
||||
export default function HeaderEditProfile() {
|
||||
return (
|
||||
<LayoutNavbarHome>
|
||||
<Grid justify='center' align='center'>
|
||||
<Grid.Col span="auto">
|
||||
<LayoutIconBack />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Text ta={'center'} fw={'bold'} c={'white'}>EDIT PROFIL</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span="auto"></Grid.Col>
|
||||
</Grid>
|
||||
</LayoutNavbarHome>
|
||||
<LayoutNavbarNew back='' title='Edit Profil' menu='' />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export function InfoTitleProfile() {
|
||||
return (
|
||||
<Group justify="space-between" grow py={5}>
|
||||
<Text fw={'bold'} fz={20}>Informasi</Text>
|
||||
<Text ta={"right"} c={"blue"} onClick={() => router.push('/profile/edit')}>Edit</Text>
|
||||
<Text style={{ cursor: 'pointer' }} ta={"right"} c={"blue"} onClick={() => router.push('/profile/edit')}>Edit</Text>
|
||||
</Group>
|
||||
)
|
||||
}
|
||||
@@ -13,9 +13,9 @@ export default function ViewProfile() {
|
||||
<LayoutNavbarHome>
|
||||
<Group justify="space-between">
|
||||
<LayoutIconBack />
|
||||
<ActionIcon variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Info">
|
||||
{/* <ActionIcon variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Info">
|
||||
<BsInfo size={20} color='white' />
|
||||
</ActionIcon>
|
||||
</ActionIcon> */}
|
||||
</Group>
|
||||
<Stack
|
||||
align="center"
|
||||
|
||||
Reference in New Issue
Block a user