Skip to content

Instantly share code, notes, and snippets.

@mstijak
Created June 2, 2021 06:08
Show Gist options
  • Save mstijak/0dcea4b191f937e58a7d1aab6e7a8983 to your computer and use it in GitHub Desktop.
Save mstijak/0dcea4b191f937e58a7d1aab6e7a8983 to your computer and use it in GitHub Desktop.
const NavItem = ({ text, href, tooltip, onClick, className, icon, badge, expanded }) => (
<cx>
<Link
href={href}
url-bind="url"
class="hover:bg-gray-100 flex items-center px-3 py-3 text-gray-600 relative font-semibold whitespace-nowrap text-opacity-70 text-[15px] border-l-[3px] border-transparent cursor-pointer"
className={className}
activeClass="!bg-blue-100 !border-blue-500 !text-blue-500 !opacity-100"
tooltip={tooltip}
onClick={onClick}
match="subroute"
>
<Icon name={icon} class="w-7 h-7 ml-3 mr-3 opacity-80" />
<div text={text} class="flex-grow" />
<div text={badge} visible={badge} class="text-xs bg-black bg-opacity-20 rounded-full px-3 py-1" />
<Icon
name="drop-down"
class="w-5 h-5 mr-2 transform transition-all opacity-80"
visible={!!expanded}
className={{
'rotate-180': expanded,
}}
/>
</Link>
</cx>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment