2021-01-30 20:22:16 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { NavLink } from 'react-router-dom';
|
2021-07-22 17:15:27 +00:00
|
|
|
import tw, { styled } from 'twin.macro';
|
2021-01-30 20:22:16 +00:00
|
|
|
|
|
|
|
export const SubNavigation = styled.div`
|
2021-10-10 19:03:28 +00:00
|
|
|
${tw`flex flex-row items-center flex-shrink-0 h-12 mb-4 border-b border-neutral-700`};
|
2021-01-30 20:22:16 +00:00
|
|
|
|
2021-10-10 19:03:28 +00:00
|
|
|
& > a {
|
|
|
|
${tw`flex flex-row items-center h-full px-4 border-b text-neutral-300 text-base whitespace-nowrap border-transparent`};
|
2021-01-30 20:22:16 +00:00
|
|
|
|
2021-10-10 19:03:28 +00:00
|
|
|
& > svg {
|
|
|
|
${tw`w-6 h-6 mr-2`};
|
2021-01-30 20:22:16 +00:00
|
|
|
}
|
2021-10-10 20:13:10 +00:00
|
|
|
|
2021-10-10 19:03:28 +00:00
|
|
|
&:active, &.active {
|
|
|
|
${tw`text-primary-300 border-primary-300`};
|
|
|
|
}
|
|
|
|
}
|
2021-01-30 20:22:16 +00:00
|
|
|
`;
|
|
|
|
|
2021-10-10 19:03:28 +00:00
|
|
|
interface Props {
|
|
|
|
to: string;
|
|
|
|
name: string;
|
2021-10-10 20:13:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface PropsWithIcon extends Props {
|
2021-10-10 19:03:28 +00:00
|
|
|
icon: React.ComponentType;
|
2021-10-10 20:13:10 +00:00
|
|
|
children?: never;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface PropsWithoutIcon extends Props {
|
|
|
|
icon?: never;
|
|
|
|
children: React.ReactNode;
|
2021-10-10 19:03:28 +00:00
|
|
|
}
|
|
|
|
|
2021-10-10 20:13:10 +00:00
|
|
|
export const SubNavigationLink = ({ to, name, icon: IconComponent, children }: PropsWithIcon | PropsWithoutIcon) => (
|
|
|
|
<NavLink to={to} exact>
|
|
|
|
{IconComponent ? <IconComponent/> : children}{name}
|
|
|
|
</NavLink>
|
|
|
|
);
|