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.

99 lines
4.9 KiB
React

import React, { useState } from 'react';
3 years ago
import { ToastContainer } from 'react-toastify';
import NavLink from '@/Components/NavLink';
import ResponsiveNavLink from '@/Components/ResponsiveNavLink';
import { Link } from '@inertiajs/inertia-react';
export default function Authenticated({ header, children }) {
const [showingNavigationDropdown, setShowingNavigationDropdown] = useState(false);
return (
<div className="min-h-screen bg-gray-100">
<nav className="bg-white border-b border-gray-100">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between h-16">
<div className="flex">
<div className="flex-shrink-0 flex items-center">
<Link href="/">
{/* <ApplicationLogo className="block h-9 w-auto text-gray-500" /> */}
<h1 className="font-bold text-2xl">Expense Tracker</h1>
</Link>
</div>
<div className="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
3 years ago
<NavLink href={route('categories')} active={route().current('categories')}>
Category
</NavLink>
3 years ago
<NavLink href={route('transactions')} active={route().current('transactions')}>
Transaction
</NavLink>
3 years ago
<NavLink href={route('summary')} active={route().current('summary')}>
Summary
</NavLink>
</div>
</div>
<div className="-mr-2 flex items-center sm:hidden">
<button
onClick={() => setShowingNavigationDropdown((previousState) => !previousState)}
className="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out"
>
<svg className="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path
className={!showingNavigationDropdown ? 'inline-flex' : 'hidden'}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M4 6h16M4 12h16M4 18h16"
/>
<path
className={showingNavigationDropdown ? 'inline-flex' : 'hidden'}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
</div>
</div>
</div>
<div className={(showingNavigationDropdown ? 'block' : 'hidden') + ' sm:hidden'}>
<div className="pt-2 pb-3 space-y-1">
3 years ago
<ResponsiveNavLink href={route('categories')} active={route().current('categories')}>
3 years ago
Category
</ResponsiveNavLink>
3 years ago
<ResponsiveNavLink href={route('transactions')} active={route().current('transactions')}>
3 years ago
Transaction
</ResponsiveNavLink>
3 years ago
<ResponsiveNavLink href={route('summary')} active={route().current('summary')}>
Summary
</ResponsiveNavLink>
</div>
</div>
</nav>
{header && (
<header className="bg-white shadow">
<div className="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">{header}</div>
</header>
)}
3 years ago
<main className='max-w-7xl mx-auto'>{children}</main>
3 years ago
<ToastContainer
position="top-right"
autoClose={5000}
theme='colored'
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</div>
);
}