style : update navbar project

This commit is contained in:
lukman
2024-07-22 11:17:32 +08:00
parent f326c76487
commit 611d5ddcf6

View File

@@ -1,191 +1,98 @@
"use client" "use client"
import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global'; import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, Text, TextInput, Title } from '@mantine/core'; import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, rem, Tabs, Text, TextInput, Title } from '@mantine/core';
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { HiMenu } from 'react-icons/hi'; import { HiMenu } from 'react-icons/hi';
import { HiMagnifyingGlass, HiMiniPresentationChartBar, HiOutlineListBullet, HiSquares2X2 } from 'react-icons/hi2'; import { HiMagnifyingGlass, HiMiniPresentationChartBar, HiOutlineListBullet, HiSquares2X2 } from 'react-icons/hi2';
import { MdAccountCircle } from 'react-icons/md'; import { MdAccountCircle } from 'react-icons/md';
import { RiCircleFill } from "react-icons/ri"; import { RiCircleFill } from "react-icons/ri";
import DrawerProject from './drawer_project'; import DrawerProject from './drawer_project';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import { TbClockPause } from 'react-icons/tb';
const dataProject = [ import { IoIosCheckmarkCircleOutline } from 'react-icons/io';
{ import { IoCloseCircleOutline } from 'react-icons/io5';
id: 1, import ProjectProcess from '../project_process';
title: 'Project 1', import ProjectDone from '../project_done';
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', import ProjectCencel from '../project_cencel';
status: 'PROJECT SELESAI',
color: '#387529'
},
{
id: 2,
title: 'Project 2',
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
status: 'PROJECT SELESAI',
color: '#387529'
},
{
id: 3,
title: 'Project 3',
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
status: 'PROJECT SELESAI',
color: '#387529'
},
{
id: 4,
title: 'Project 4',
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
status: 'PROSES',
color: '#C5771A'
},
{
id: 5,
title: 'Project5',
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
status: 'PROSES',
color: '#C5771A'
},
{
id: 6,
title: 'Project 6',
description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba',
status: 'PROSES',
color: '#C5771A'
},
]
export default function NavbarProject() { export default function NavbarProject() {
const [isList, setIsList] = useState(false)
const [openDrawer, setOpenDrawer] = useState(false) const [openDrawer, setOpenDrawer] = useState(false)
const router = useRouter()
const handleList = () => { const iconStyle = { width: rem(20), height: rem(20) };
setIsList(!isList)
const tabsData = [
{
value: 'segera',
label: 'Proyek Proses',
mobileLabel: 'Proses',
icon: <TbClockPause style={iconStyle} />,
},
{
value: 'selesai',
label: 'Proyek Selesai',
mobileLabel: 'Selesai',
icon: <IoIosCheckmarkCircleOutline style={iconStyle} />,
},
{
value: 'batal',
label: 'Proyek Batal',
mobileLabel: ' Batal',
icon: <IoCloseCircleOutline style={iconStyle} />,
},
];
const [isMobile, setIsMobile] = useState(false);
useEffect(() => {
const handleResize = () => {
if (window.innerWidth < 495) {
setIsMobile(true);
} else {
setIsMobile(false);
} }
};
window.addEventListener('resize', handleResize);
handleResize();
return () => {
window.removeEventListener('resize', handleResize);
};
}, []);
return ( return (
<Box> <Box>
<LayoutNavbarNew back='/home' title='proyek' <LayoutNavbarNew back='/home' title='proyek'
menu={<ActionIcon variant="light" onClick={() => setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings"> menu={<ActionIcon variant="light" onClick={() => setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
<HiMenu size={20} color='white' /> <HiMenu size={20} color='white' />
</ActionIcon>} /> </ActionIcon>} />
<Box p={20}> <Box p={20}>
<Grid justify='center' align='center'> <Tabs variant="pills" radius="xl" defaultValue="segera">
<Grid.Col span={10}> <Tabs.List>
<TextInput {tabsData.map((tab) => (
styles={{ <Tabs.Tab
input: { key={tab.value}
color: WARNA.biruTua, value={tab.value}
borderRadius: '#A3A3A3', color={WARNA.biruTua}
borderColor: '#A3A3A3', leftSection={tab.icon}
},
}}
size="md"
radius={30}
leftSection={<HiMagnifyingGlass size={20} />}
placeholder="Pencarian"
/>
</Grid.Col>
<Grid.Col span={'auto'}>
<Flex justify={'center'}>
{isList ? (
<HiOutlineListBullet size={35} color={WARNA.biruTua} onClick={handleList} />
) : (
<HiSquares2X2 size={35} color={WARNA.biruTua} onClick={handleList} />
)}
</Flex>
</Grid.Col>
</Grid>
<Box pt={20}>
<Box bg={"#DCEED8"} p={10} style={{ borderRadius: 10 }}>
<Text fw={'bold'} c={WARNA.biruTua}>Total Proyek</Text>
<Flex justify={'center'} align={'center'} h={'100%'}>
<Text fz={40} fw={'bold'} c={WARNA.biruTua}>35</Text>
</Flex>
</Box>
<Grid pt={15}>
<Grid.Col span={6}>
<Box bg={"#DCEED8"} p={10} style={{ borderRadius: 10 }}>
<Text ta={'center'} fw={'bold'} c={'#387529'}>Proyek Selesai</Text>
<Flex justify={'center'} align={'center'} h={'100%'}>
<Text fz={40} fw={'bold'} c={'#387529'}>35</Text>
</Flex>
</Box>
</Grid.Col>
<Grid.Col span={6}>
<Box bg={"#DCEED8"} p={10} style={{ borderRadius: 10 }}>
<Text ta={'center'} fw={'bold'} c={'#C5771A'}>Proyek Proses</Text>
<Flex justify={'center'} align={'center'} h={'100%'}>
<Text fz={40} fw={'bold'} c={'#C5771A'}>35</Text>
</Flex>
</Box>
</Grid.Col>
</Grid>
{isList ? (
<Box pt={20}>
{dataProject.map((v, i) => {
return (
<Box key={i}>
<Group justify="space-between" mb={10} onClick={() => router.push(`/project/${v.id}`)}>
<Group>
<Center>
<ActionIcon
variant="gradient"
size={50}
aria-label="Gradient action icon"
radius={100}
gradient={{
from: '#DFDA7C',
to: '#F2AF46',
deg: 174
}}
> >
<HiMiniPresentationChartBar size={25} color={WARNA.biruTua} /> {isMobile ? tab.mobileLabel : tab.label}
</ActionIcon> </Tabs.Tab>
</Center> ))}
<Text>{v.title}</Text> </Tabs.List>
</Group>
<Box> <Tabs.Panel value="segera">
<RiCircleFill size={12} color={v.color} /> <ProjectProcess />
</Tabs.Panel>
<Tabs.Panel value="selesai">
<ProjectDone />
</Tabs.Panel>
<Tabs.Panel value="batal">
<ProjectCencel />
</Tabs.Panel>
</Tabs>
</Box> </Box>
</Group>
<Divider my="sm" />
</Box>
);
})}
</Box>
) : (
<Box pt={20}>
{dataProject.map((v, i) => {
return (
<Box key={i} mb={20}>
<Card shadow="sm" padding="md" component="a" radius={10} onClick={() => router.push(`/project/${v.id}`)}>
<Card.Section>
<Box h={120} bg={WARNA.biruTua}>
<Flex justify={'center'} align={'center'} h={"100%"}>
<Title order={3} c={"white"}>{v.title}</Title>
</Flex>
</Box>
</Card.Section>
<Box pt={10}>
<Text>{v.description}</Text>
<Group align='center' pt={10} justify='space-between'>
<Badge color={v.color}>{v.status}</Badge>
<Avatar.Group>
<Avatar>
<MdAccountCircle size={32} color={WARNA.biruTua} />
</Avatar>
<Avatar>+5</Avatar>
</Avatar.Group>
</Group>
</Box>
</Card>
</Box>
);
})}
</Box>
)}
</Box>
</Box >
<LayoutDrawer opened={openDrawer} title={'Menu'} onClose={() => setOpenDrawer(false)}> <LayoutDrawer opened={openDrawer} title={'Menu'} onClose={() => setOpenDrawer(false)}>
<DrawerProject /> <DrawerProject />
</LayoutDrawer> </LayoutDrawer>