6 changed files with 95 additions and 130 deletions
@ -0,0 +1,36 @@ |
|||
import type React from 'react'; |
|||
|
|||
import type { Link } from 'type-route'; |
|||
|
|||
export interface TabProps { |
|||
link?: Link; |
|||
icon: React.ReactNode; |
|||
title: string; |
|||
active: boolean; |
|||
} |
|||
|
|||
export const Tab = ({ link, icon, title, active }: TabProps): JSX.Element => { |
|||
return ( |
|||
<div className="group relative flex-grow"> |
|||
<div |
|||
className={`peer flex cursor-pointer select-none py-1 dark:text-white ${ |
|||
active |
|||
? 'z-10 -mr-1 rounded-t-lg bg-gray-100 dark:bg-primaryDark' |
|||
: 'dark:bg-secondaryDark' |
|||
}`}
|
|||
{...(link && link)} |
|||
> |
|||
<div |
|||
className={`w-full px-2 ${ |
|||
active ? '' : 'border-l group-first:border-l-0 dark:border-gray-600' |
|||
}`}
|
|||
> |
|||
<div className="flex gap-2"> |
|||
<div className="my-auto">{icon}</div> |
|||
{title} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
); |
|||
}; |
|||
@ -1,78 +0,0 @@ |
|||
import type React from 'react'; |
|||
|
|||
import { FiMessageCircle, FiSettings } from 'react-icons/fi'; |
|||
import { RiMindMap, RiRoadMapLine } from 'react-icons/ri'; |
|||
import { VscExtensions } from 'react-icons/vsc'; |
|||
|
|||
import { NavLinkButton } from '@components/layout/Sidebar/NavLinkButton'; |
|||
import { routes, useRoute } from '@core/router'; |
|||
import { toggleMobileNav } from '@core/slices/appSlice'; |
|||
import { useAppDispatch } from '@hooks/useAppDispatch'; |
|||
|
|||
export interface ButtonNavProps { |
|||
toggleSettingsOpen: () => void; |
|||
} |
|||
|
|||
export const ButtonNav = ({ |
|||
toggleSettingsOpen, |
|||
}: ButtonNavProps): JSX.Element => { |
|||
const route = useRoute(); |
|||
const dispatch = useAppDispatch(); |
|||
|
|||
return ( |
|||
<div className="z-30 flex justify-between border-t border-gray-300 bg-white px-6 py-2 dark:border-gray-600 dark:bg-primaryDark"> |
|||
<div |
|||
onClick={(): void => { |
|||
dispatch(toggleMobileNav()); |
|||
}} |
|||
> |
|||
<NavLinkButton |
|||
active={route.name === 'messages'} |
|||
link={routes.messages().link} |
|||
> |
|||
<FiMessageCircle className="h-5 w-5" /> |
|||
</NavLinkButton> |
|||
</div> |
|||
<div |
|||
onClick={(): void => { |
|||
dispatch(toggleMobileNav()); |
|||
}} |
|||
> |
|||
<NavLinkButton |
|||
active={route.name === 'nodes'} |
|||
link={routes.nodes().link} |
|||
> |
|||
<RiMindMap className="h-5 w-5" /> |
|||
</NavLinkButton> |
|||
</div> |
|||
<div |
|||
onClick={(): void => { |
|||
dispatch(toggleMobileNav()); |
|||
}} |
|||
> |
|||
<NavLinkButton active={route.name === 'map'} link={routes.map().link}> |
|||
<RiRoadMapLine className="h-5 w-5" /> |
|||
</NavLinkButton> |
|||
</div> |
|||
<div |
|||
onClick={(): void => { |
|||
dispatch(toggleMobileNav()); |
|||
}} |
|||
> |
|||
<NavLinkButton |
|||
active={route.name === 'extensions'} |
|||
link={routes.extensions().link} |
|||
> |
|||
<VscExtensions className="h-5 w-5" /> |
|||
</NavLinkButton> |
|||
</div> |
|||
<NavLinkButton |
|||
action={(): void => { |
|||
toggleSettingsOpen(); |
|||
}} |
|||
> |
|||
<FiSettings className="h-5 w-5" /> |
|||
</NavLinkButton> |
|||
</div> |
|||
); |
|||
}; |
|||
@ -1,38 +0,0 @@ |
|||
import type React from 'react'; |
|||
|
|||
import { m } from 'framer-motion'; |
|||
import type { Link } from 'type-route'; |
|||
|
|||
export interface NavLinkButtonProps { |
|||
link?: Link; |
|||
active?: boolean; |
|||
action?: () => void; |
|||
children: React.ReactNode; |
|||
} |
|||
|
|||
export const NavLinkButton = ({ |
|||
link, |
|||
active, |
|||
action, |
|||
children, |
|||
}: NavLinkButtonProps): JSX.Element => { |
|||
return ( |
|||
<m.div |
|||
whileHover={{ scale: 1.01 }} |
|||
whileTap={{ scale: 0.99 }} |
|||
animate={active ? 'selected' : 'deselected'} |
|||
initial={{ borderColor: '#1C1D23' }} |
|||
variants={{ |
|||
selected: { borderColor: '#67ea94' }, |
|||
deselected: { borderColor: '#1C1D23' }, |
|||
}} |
|||
className="cursor-pointer rounded-full border-2 p-3 hover:bg-opacity-80 hover:shadow-md dark:bg-secondaryDark dark:text-white" |
|||
onClick={(): void => { |
|||
action && action(); |
|||
}} |
|||
{...(link && link)} |
|||
> |
|||
{children} |
|||
</m.div> |
|||
); |
|||
}; |
|||
Loading…
Reference in new issue