import React, { useEffect } from 'react' import { ToastContainer, toast } from 'react-toastify' import { router, usePage } from '@inertiajs/react' import { HiOutlineHome } from 'react-icons/hi' import { HiArrowPathRoundedSquare, HiBars3, HiOutlineGift, HiOutlineShoppingCart, } from 'react-icons/hi2' export default function CustomerLayout({ children }) { const { props: { auth: { user }, cart_count, flash, }, } = usePage() const handleOnClick = (r) => { router.get(route(r)) } const isActive = (r) => { if (route().current(r)) { return 'text-blue-700 font-bold' } return 'text-gray-600 font-light' } useEffect(() => { if (flash.message !== null) { toast(flash.message.message, { type: flash.message.type }) } }, [flash]) return (
{children}
handleOnClick('home.index')} >
Beranda
handleOnClick('cart.index')} >
{cart_count}
Keranjang
handleOnClick('customer.coin.exchange')} >
Coin
handleOnClick('transactions.index')} >
Transaksi
handleOnClick( user !== null ? 'customer.profile.index' : 'customer.login' ) } >
Menu
) }