You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.9 KiB
React

import React from 'react'
1 year ago
import { ToastContainer, toast } from 'react-toastify'
import { router, usePage } from '@inertiajs/react'
import { HiOutlineHome, HiOutlineUserCircle } from 'react-icons/hi'
import {
HiArrowPathRoundedSquare,
HiBars3,
HiOutlineShoppingCart,
} from 'react-icons/hi2'
export default function CustomerLayout({ children }) {
const {
props: {
auth: { user },
},
} = usePage()
const handleOnClick = (r) => {
router.get(route(r))
}
const isActive = (r) => {
if (route().current(r)) {
return 'text-blue-700'
}
return 'text-gray-600'
}
return (
1 year ago
<div className="min-h-screen flex flex-col sm:justify-center items-center">
<div className="flex flex-col w-full bg-white shadow pb-20 min-h-[calc(90dvh)] max-w-md">
1 year ago
<div>{children}</div>
</div>
1 year ago
<div className="fixed bottom-0 flex flex-row justify-around w-full bg-gray-50 max-w-md">
1 year ago
<div
className={`pb-1 pt-2 px-5 hover:bg-blue-200 flex flex-col items-center ${isActive(
'home.index'
)}`}
1 year ago
onClick={() => handleOnClick('home.index')}
>
<HiOutlineHome className="h-6 w-6" />
<div className="text-xs font-light">Beranda</div>
1 year ago
</div>
<div className="py-2 px-5 hover:bg-blue-200 flex flex-col items-center text-gray-600">
<div className="flex flex-row">
<HiOutlineShoppingCart className="h-6 w-6" />
<div>
<div className="bg-blue-300 text-blue-600 rounded-lg px-1 text-xs -ml-2">
1
</div>
1 year ago
</div>
</div>
<div className="text-xs font-light">Keranjang</div>
1 year ago
</div>
<div className="py-2 px-5 hover:bg-blue-200 flex flex-col items-center text-gray-600">
<HiArrowPathRoundedSquare className="h-6 w-6" />
<div className="text-xs font-light">Transaksi</div>
</div>
<div
className={`py-2 px-5 hover:bg-blue-200 flex flex-col items-center ${isActive(
'customer.profile.*'
)}`}
onClick={() =>
handleOnClick(
user !== null
? 'customer.profile.index'
: 'customer.login'
)
}
>
<HiBars3 className="h-6 w-6" />
<div className="text-xs font-light">Menu</div>
1 year ago
</div>
</div>
1 year ago
<ToastContainer />
</div>
)
}