Skip to content

Commit

Permalink
Add Nav component
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Jun 30, 2022
1 parent 45153b7 commit 5083cd2
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/components/Nav/Nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { ReactNode } from 'react';

import { Tab } from '@headlessui/react';
import clsx from 'clsx';

export interface NavProps {
/**
* Custom classes for the label
*/
className?: string;
/**
* The label attached to the label
*/
children?: ReactNode;
}

/**
* Primary UI component for user interaction
*/
export const Nav = ({
className,
children
}: NavProps) => {
return (
<nav
className={
clsx(
'pivot',
className
)
}
>
{children}
</nav>
);
};

export default Nav;
2 changes: 2 additions & 0 deletions src/components/Nav/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './Nav';
export type { NavProps } from './Nav';
45 changes: 45 additions & 0 deletions src/components/NavItem/NavItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { ReactNode } from 'react';

import clsx from 'clsx';

export interface NavItemProps {
/**
* Custom classes for the label
*/
active?: boolean;
/**
* Custom classes for the label
*/
className?: string;
/**
* The label attached to the label
*/
children?: ReactNode;
}

/**
* Primary UI component for user interaction
*/
export const NavItem = ({
className,
active,
children
}: NavItemProps) => {
return (
<>
<button
className={clsx(
'pivot-link',
{
'active': active
},
className
)}
>
{children}
</button>
</>
);
};

export default NavItem;
2 changes: 2 additions & 0 deletions src/components/NavItem/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './NavItem';
export type { NavItemProps } from './NavItem';
6 changes: 6 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ export type { MenuItemsProps } from '@components/MenuItems';
export { default as MenuTrigger } from '@components/MenuTrigger';
export type { MenuTriggerProps } from '@components/MenuTrigger';

export { default as Nav } from '@components/Nav';
export type { NavProps } from '@components/Nav';

export { default as NavItem } from '@components/NavItem';
export type { NavItemProps } from '@components/NavItem';

export { default as Offcanvas } from '@components/Offcanvas';
export type { OffcanvasProps } from '@components/Offcanvas';

Expand Down
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ export type { MenuItemsProps } from '@components/MenuItems';
export { default as MenuTrigger } from '@components/MenuTrigger';
export type { MenuTriggerProps } from '@components/MenuTrigger';

export { default as Nav } from '@components/Nav';
export type { NavProps } from '@components/Nav';

export { default as NavItem } from '@components/NavItem';
export type { NavItemProps } from '@components/NavItem';

export { default as Offcanvas } from '@components/Offcanvas';
export type { OffcanvasProps } from '@components/Offcanvas';

Expand Down

0 comments on commit 5083cd2

Please sign in to comment.