Skip to content

Commit

Permalink
Fix and simplify global header links
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegach committed Jun 19, 2024
1 parent d3d80fe commit 563890d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
4 changes: 1 addition & 3 deletions packages/ui/src/header/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant: 'home' | 'system';
active?: boolean;
external?: boolean;
externalIcon?: boolean;
href: string;
title: string;
}

export const Button: FC<ButtonProps> = ({
variant,
external = false,
externalIcon = false,
active = false,
href,
title,
Expand All @@ -44,7 +42,7 @@ export const Button: FC<ButtonProps> = ({
target={external ? '_blank' : undefined}
>
{title}
{externalIcon ? (
{external ? (
<div className="ui-h-full ui-flex ui-items-start ui-py-1.5">
<Arrow />
</div>
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const Header: FC<HeaderProps> = ({
<Button
active={pathname === item.href}
external={item.external}
externalIcon={item.externalIcon}
href={item.href}
key={item.title}
title={item.title}
Expand Down
5 changes: 1 addition & 4 deletions packages/ui/src/header/mobile-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const MobileMenu: FC<HeaderProps> = ({ variant }) => {
{nav.map((item) => (
<DropdownItem
external={item.external}
externalIcon={item.externalIcon}
href={item.href}
key={item.title}
title={item.title}
Expand Down Expand Up @@ -81,13 +80,11 @@ interface DropdownItemProps {
title: ReactNode;
external?: boolean;
href: string;
externalIcon?: boolean;
}

export const DropdownItem: FC<DropdownItemProps> = ({
title,
external,
externalIcon,
href,
}) => {
const Comp = external ? 'a' : Link;
Expand All @@ -99,7 +96,7 @@ export const DropdownItem: FC<DropdownItemProps> = ({
>
<Comp href={href} target={external ? '_blank' : undefined}>
{title}
{externalIcon ? (
{external ? (
<div className="ui-h-full ui-flex ui-items-start ui-py-1.5">
<Arrow />
</div>
Expand Down
5 changes: 0 additions & 5 deletions packages/ui/src/header/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,23 @@ export const nav = [
{
title: 'Addons',
href: '/integrations',
external: true,
},
{
title: 'Showcase',
href: '/showcase',
external: true,
},
{
title: 'Blog',
href: '/blog',
external: true,
},
{
title: 'Visual Test',
href: 'https://www.chromatic.com/storybook?utm_source=storybook_website&utm_medium=link&utm_campaign=storybook',
external: true,
externalIcon: true,
},
{
title: 'Enterprise',
href: 'https://www.chromatic.com/sales?utm_source=storybook_website&utm_medium=link&utm_campaign=storybook',
external: true,
externalIcon: true,
},
];

0 comments on commit 563890d

Please sign in to comment.