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.

76 lines
2.6 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,
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 h-8 w-8'
}
return 'text-gray-600 h-8 w-8'
}
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="py-2 px-5 hover:bg-blue-200"
onClick={() => handleOnClick('home.index')}
>
<HiOutlineHome className={isActive('home.index')} />
</div>
<div className="py-2 px-5 hover:bg-blue-200 flex flex-row">
<HiOutlineShoppingCart className="text-gray-600 h-8 w-8" />
<div>
<div className="bg-blue-300 text-blue-600 rounded-lg px-1 text-xs -ml-2">
1
</div>
</div>
</div>
<div className="py-2 px-5 hover:bg-blue-200">
<HiArrowPathRoundedSquare className="text-gray-600 h-8 w-8" />
</div>
{user !== null ? (
<div
1 year ago
className="py-2 px-5 hover:bg-blue-200"
onClick={() => handleOnClick('customer.profile.index')}
>
1 year ago
<HiOutlineUserCircle
className={isActive('customer.profile.*')}
/>
</div>
1 year ago
) : (
<div
className="py-2 px-5 hover:bg-blue-200"
onClick={() => handleOnClick('customer.login')}
>
<HiOutlineUserCircle
className={isActive('customer.login')}
/>
</div>
1 year ago
)}
</div>
1 year ago
<ToastContainer />
</div>
)
}