import React, { useState } from 'react'; import tw from 'twin.macro'; import { useStoreState } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import { NavLink, RouteComponentProps } from 'react-router-dom'; import styled from 'styled-components/macro'; const Sidebar = styled.div` ${tw`h-screen flex flex-col items-center bg-neutral-900 overflow-x-hidden`}; `; const Navigation = styled.div` ${tw`w-full flex flex-col px-4`}; & > span { ${tw`font-header font-medium text-xs text-neutral-300 whitespace-no-wrap uppercase ml-4 mb-1`}; &:not(:first-of-type) { ${tw`mt-4`}; } } & > a { ${tw`h-10 w-full flex flex-row items-center text-neutral-300 px-4 transition-all duration-100 cursor-pointer`}; & > svg { ${tw`h-6 w-6`}; } & > span { ${tw`font-header font-medium text-lg leading-none ml-3`}; } &:hover { ${tw`text-neutral-50`}; } &:active, &.active { ${tw`text-neutral-50 bg-neutral-800 rounded`} } } `; const CollapsedNavigation = styled.div` ${tw`w-full flex flex-col px-4`}; & > span { ${tw`opacity-0 whitespace-no-wrap`}; &:not(:first-of-type) { ${tw`mt-4`}; } } & > a { ${tw`h-10 w-full flex flex-row items-center justify-center text-neutral-300 transition-all duration-100 cursor-pointer`}; & > svg { ${tw`h-6 w-6 flex flex-shrink-0`}; } & > span { ${tw`hidden`}; } &:hover { ${tw`text-neutral-50`}; } &:active, &.active { ${tw`text-neutral-50 bg-neutral-800 rounded`} } } `; type Props = { url: string, }; const NavItems = ({ url }: Props) => { return ( <> Administration Overview Settings API Keys Management Databases Locations Nodes Servers Users Service Management Nests Packs Mounts > ); }; export default ({ match }: RouteComponentProps<{ id: string }>) => { const name = useStoreState((state: ApplicationStore) => state.settings.data!.name); const [ collapsed, setCollapsed ] = useState(); return ( { setCollapsed(!collapsed); } }> { !collapsed ? {name} : } {!collapsed ? <> Matthew Penner Super Administrator > : <> > } ); };