upd: val isdrawer
Deskripsi: - update isdrawer jotai ke hookstate - aplikasiin ke page grup No Issues
This commit is contained in:
@@ -4,7 +4,7 @@ import LayoutIconBack from "./layout/layout_icon_back";
|
||||
import LoadingPage from "./layout/layout_loading_page";
|
||||
import LayoutLogin from "./layout/layout_login";
|
||||
import LayoutNavbarHome from "./layout/layout_navbar_home";
|
||||
import { isDrawer } from "./val/idDrawer";
|
||||
import { isDrawer } from "./val/isDrawer";
|
||||
|
||||
export { WARNA }
|
||||
export { LayoutLogin }
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { atom } from "jotai"
|
||||
|
||||
export const isDrawer = atom(false)
|
||||
4
src/module/_global/val/isDrawer.ts
Normal file
4
src/module/_global/val/isDrawer.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
'use client'
|
||||
import { hookstate } from '@hookstate/core';
|
||||
|
||||
export const isDrawer = hookstate(false)
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isDrawer, LayoutDrawer, WARNA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Button, Center, Flex, Group, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
||||
import { useAtom } from 'jotai';
|
||||
import React, { useState } from 'react';
|
||||
@@ -6,11 +7,11 @@ import { IoAddCircle } from "react-icons/io5";
|
||||
|
||||
export default function DrawerGroup() {
|
||||
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
||||
const [openDrawer, setOpenDrawer] = useAtom(isDrawer)
|
||||
const openDrawer = useHookstate(isDrawer)
|
||||
|
||||
function onCLose() {
|
||||
setOpenDrawerGroup(false)
|
||||
setOpenDrawer(false)
|
||||
openDrawer.set(false)
|
||||
}
|
||||
return (
|
||||
<Box>
|
||||
@@ -55,7 +56,7 @@ export default function DrawerGroup() {
|
||||
MASUK
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
</LayoutDrawer>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use client"
|
||||
import { isDrawer, LayoutDrawer, LayoutIconBack, LayoutNavbarHome, WARNA } from '@/module/_global';
|
||||
import { ActionIcon, Box, Drawer, Grid, Group, Text } from '@mantine/core';
|
||||
import { useAtom } from 'jotai';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { HiMenu } from "react-icons/hi";
|
||||
import DrawerGroup from './drawer_group';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
|
||||
export default function NavbarGroup() {
|
||||
const [openDrawer, setOpenDrawer] = useAtom(isDrawer)
|
||||
const openDrawer = useHookstate(isDrawer)
|
||||
const router = useRouter()
|
||||
return (
|
||||
<>
|
||||
@@ -22,14 +22,14 @@ export default function NavbarGroup() {
|
||||
</Grid.Col>
|
||||
<Grid.Col span="auto">
|
||||
<Group justify='flex-end'>
|
||||
<ActionIcon onClick={() => setOpenDrawer(true)} variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||
<ActionIcon onClick={() => openDrawer.set(true)} variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||
<HiMenu size={20} color='white' />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</LayoutNavbarHome>
|
||||
<LayoutDrawer opened={openDrawer} title={'MENU'} onClose={() => setOpenDrawer(false)}>
|
||||
<LayoutDrawer opened={openDrawer.get()} title={'MENU'} onClose={() => openDrawer.set(false)}>
|
||||
<DrawerGroup />
|
||||
</LayoutDrawer>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user