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 LoadingPage from "./layout/layout_loading_page";
|
||||||
import LayoutLogin from "./layout/layout_login";
|
import LayoutLogin from "./layout/layout_login";
|
||||||
import LayoutNavbarHome from "./layout/layout_navbar_home";
|
import LayoutNavbarHome from "./layout/layout_navbar_home";
|
||||||
import { isDrawer } from "./val/idDrawer";
|
import { isDrawer } from "./val/isDrawer";
|
||||||
|
|
||||||
export { WARNA }
|
export { WARNA }
|
||||||
export { LayoutLogin }
|
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 { 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 { Box, Button, Center, Flex, Group, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
@@ -6,11 +7,11 @@ import { IoAddCircle } from "react-icons/io5";
|
|||||||
|
|
||||||
export default function DrawerGroup() {
|
export default function DrawerGroup() {
|
||||||
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
||||||
const [openDrawer, setOpenDrawer] = useAtom(isDrawer)
|
const openDrawer = useHookstate(isDrawer)
|
||||||
|
|
||||||
function onCLose() {
|
function onCLose() {
|
||||||
setOpenDrawerGroup(false)
|
setOpenDrawerGroup(false)
|
||||||
setOpenDrawer(false)
|
openDrawer.set(false)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
@@ -55,7 +56,7 @@ export default function DrawerGroup() {
|
|||||||
MASUK
|
MASUK
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { isDrawer, LayoutDrawer, LayoutIconBack, LayoutNavbarHome, WARNA } from '@/module/_global';
|
import { isDrawer, LayoutDrawer, LayoutIconBack, LayoutNavbarHome, WARNA } from '@/module/_global';
|
||||||
import { ActionIcon, Box, Drawer, Grid, Group, Text } from '@mantine/core';
|
import { ActionIcon, Box, Drawer, Grid, Group, Text } from '@mantine/core';
|
||||||
import { useAtom } from 'jotai';
|
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import { HiMenu } from "react-icons/hi";
|
import { HiMenu } from "react-icons/hi";
|
||||||
import DrawerGroup from './drawer_group';
|
import DrawerGroup from './drawer_group';
|
||||||
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
|
||||||
export default function NavbarGroup() {
|
export default function NavbarGroup() {
|
||||||
const [openDrawer, setOpenDrawer] = useAtom(isDrawer)
|
const openDrawer = useHookstate(isDrawer)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -22,14 +22,14 @@ export default function NavbarGroup() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span="auto">
|
<Grid.Col span="auto">
|
||||||
<Group justify='flex-end'>
|
<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' />
|
<HiMenu size={20} color='white' />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</LayoutNavbarHome>
|
</LayoutNavbarHome>
|
||||||
<LayoutDrawer opened={openDrawer} title={'MENU'} onClose={() => setOpenDrawer(false)}>
|
<LayoutDrawer opened={openDrawer.get()} title={'MENU'} onClose={() => openDrawer.set(false)}>
|
||||||
<DrawerGroup />
|
<DrawerGroup />
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user