diff --git a/.storybook/preview.ts b/.storybook/preview.ts index d0604867..9889756a 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -24,6 +24,7 @@ const preview: Preview = { storySort: { order: ["Home", "Icons gallery"], }, + showPanel: true, }, }, }; diff --git a/src/components/navigation/navigation-popover.tsx b/src/components/navigation/navigation-popover.tsx new file mode 100644 index 00000000..576be6ed --- /dev/null +++ b/src/components/navigation/navigation-popover.tsx @@ -0,0 +1,67 @@ +import { Popover } from "@headlessui/react"; +import React from "react"; + +export interface NavigationPopoverButtonProps { + LeftIcon?: React.ElementType; + children: React.ReactNode; +} + +const NavigationPopoverButton = ({ children, LeftIcon }: NavigationPopoverButtonProps) => { + return ( + + <> + {LeftIcon && } + {children} + + + ); +}; + +export interface NavigationPopoverPanelItemProps { + children: React.ReactNode; +} + +const NavigationPopoverPanelItem = ({ children }: NavigationPopoverPanelItemProps) => { + return ( +
+

{children}

+
+ ); +}; + +export interface NavigationPopoverPanelProps { + children: React.ReactNode; +} + +const NavigationPopoverPanel = ({ children }: NavigationPopoverPanelProps) => { + return ( + + {children} + + ); +}; + +NavigationPopoverPanel.Item = NavigationPopoverPanelItem; + +export interface NavigationPopoverProps { + children: React.ReactNode; + showOverlay?: boolean; +} + +const NavigationPopover = ({ children, showOverlay }: NavigationPopoverProps) => { + return ( + + <> + {showOverlay && ( + + )} +
{children}
+ +
+ ); +}; + +NavigationPopover.Button = NavigationPopoverButton; +NavigationPopover.Panel = NavigationPopoverPanel; + +export { NavigationPopover }; diff --git a/src/components/navigation/navigation.stories.tsx b/src/components/navigation/navigation.stories.tsx index 072eae61..f6b950e1 100644 --- a/src/components/navigation/navigation.stories.tsx +++ b/src/components/navigation/navigation.stories.tsx @@ -6,6 +6,11 @@ import { CogIcon, HelpIcon, InfoSignIcon } from "../../icons"; const meta: Meta = { title: "Navigation", component: Navigation, + parameters: { + options: { + showPanel: false, + }, + }, }; export default meta; @@ -13,7 +18,7 @@ type Story = StoryObj; export const Default: Story = { render: () => ( -
+
Abusix
@@ -55,7 +60,25 @@ export const Default: Story = { Data Channels
- Support + + + Support + + + + Documentation + + + Support request + + + System status + + + Blog posts + + + Plans & Billing diff --git a/src/components/navigation/navigation.tsx b/src/components/navigation/navigation.tsx index 47706295..93cea7ad 100644 --- a/src/components/navigation/navigation.tsx +++ b/src/components/navigation/navigation.tsx @@ -1,6 +1,7 @@ import React from "react"; import { NavigationDisclosure } from "./navigation-disclosure"; import { NavigationGroup } from "./navigation-group"; +import { NavigationPopover } from "./navigation-popover"; export interface NavigationLogoProps { children: React.ReactNode; @@ -15,15 +16,12 @@ export interface NavigationProps { } const Navigation = ({ children }: NavigationProps) => { - return ( -
- {children} -
- ); + return
{children}
; }; Navigation.Logo = NavigationLogo; Navigation.Group = NavigationGroup; Navigation.Disclosure = NavigationDisclosure; +Navigation.Popover = NavigationPopover; export { Navigation };