feat: location.pathname based bar navigation + admin layout + separate
auth routes
This commit is contained in:
@ -1,26 +1,22 @@
|
||||
import type { FC } from "react";
|
||||
import { useBarItems } from "../tabs";
|
||||
import { Link } from "react-router";
|
||||
|
||||
export interface ISidebarProps {
|
||||
activeTab: string;
|
||||
onChangeTab: (tab: string) => void;
|
||||
}
|
||||
|
||||
const Sidebar: FC<ISidebarProps> = ({ activeTab, onChangeTab }) => {
|
||||
const barItems = useBarItems();
|
||||
const Sidebar: FC = () => {
|
||||
const [barItems, isActive] = useBarItems();
|
||||
|
||||
return (
|
||||
<div className="hidden sm:flex flex-col gap-2 items-stretch min-w-80 w-80 p-5 pt-18 min-h-screen select-none bg-white/65 dark:bg-black/65 shadow-lg shadow-gray-300 dark:shadow-gray-700">
|
||||
{barItems.map((item) => (
|
||||
<div
|
||||
key={item.tab}
|
||||
onClick={() => onChangeTab(item.tab)}
|
||||
className={`dark:text-gray-200 transition-colors text-sm cursor-pointer p-4 rounded-lg flex flex-row items-center gap-3${
|
||||
item.tab === activeTab ? " bg-gray-200 dark:bg-gray-900" : ""
|
||||
}`}
|
||||
>
|
||||
{item.icon} {item.title}
|
||||
</div>
|
||||
<Link to={item.pathname} key={item.tab}>
|
||||
<div
|
||||
className={`dark:text-gray-200 transition-colors text-sm cursor-pointer p-4 rounded-lg flex flex-row items-center gap-3${
|
||||
isActive(item) ? " bg-gray-200 dark:bg-gray-900" : ""
|
||||
}`}
|
||||
>
|
||||
{item.icon} {item.title}
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user