"use client" import { ActionIcon, Box, Group, Title, Loader } from "@mantine/core"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { IconChevronLeft } from "@tabler/icons-react"; import { AccentColor, MainColor } from "../../color"; export function Component_Header({ title, posotion, // left button hideButtonLeft, iconLeft, routerLeft, customButtonLeft, // right button iconRight, routerRight, customButtonRight, backgroundColor, }: { title: string; posotion?: any; // left button hideButtonLeft?: boolean; iconLeft?: any; routerLeft?: any; customButtonLeft?: React.ReactNode; // right button iconRight?: any; routerRight?: any; customButtonRight?: React.ReactNode; backgroundColor?: string; }) { const router = useRouter(); const [isLoading, setIsLoading] = useState(false); const [isRightLoading, setRightLoading] = useState(false); return ( <> {hideButtonLeft ? ( ) : customButtonLeft ? ( customButtonLeft ) : ( { setIsLoading(true); routerLeft === undefined ? router.back() : router.push(routerLeft, { scroll: false }); }} > {/* PAKE LOADING SAAT KLIK BACK */} {/* {isLoading ? ( ) : iconLeft ? ( iconLeft ) : ( )} */} {/* GA PAKE LOADING SAAT KLIK BACK */} {iconLeft ? iconLeft : } )} {title} {customButtonRight ? ( customButtonRight ) : iconRight === undefined ? ( ) : routerRight === undefined ? ( {iconRight} ) : ( { setRightLoading(true); router.push(routerRight); }} > {isRightLoading ? ( ) : ( iconRight )} )} ); }