Skip to content

Commit

Permalink
Add YouTube and Docs conditional links
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbermanssw committed Feb 18, 2025
1 parent c4934a5 commit 8837bfa
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 34 deletions.
88 changes: 54 additions & 34 deletions lib/components/SubMenuGroup/SubMenuGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,49 +116,69 @@ const MenuItem: React.FC<{
};

const LinkItem: React.FC<{ link: NavMenuColumnGroupItem }> = ({
link: { name, url, description, icon, iconImg },
link: { name, url, description, icon, iconImg, youtubeLink, documentationLink },

Check failure on line 119 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `·name,·url,·description,·icon,·iconImg,·youtubeLink,·documentationLink` with `⏎····name,⏎····url,⏎····description,⏎····icon,⏎····iconImg,⏎····youtubeLink,⏎····documentationLink,⏎·`
}) => {
const close = useContext(ClosePopoverContext);
const CustomLink = useLinkComponent();

return (
<CustomLink
href={url || ""}
className={cx(
"flex items-start gap-x-1 text-ssw-black hover:text-ssw-red focus:outline-none",
description ? "p-4" : "p-2",
)}
onClick={() => {
if (close) close();
}}
>
{(icon || iconImg) && (
<div className="flex shrink-0 items-center justify-center text-ssw-red">
<MegaIcon
className="h-6 w-6"
icon={icon as AvailableIcons}
iconImg={iconImg}
/>
</div>
)}
<div>
<CustomLink
href={url || ""}
className={cx(
"flex items-start gap-x-1 text-ssw-black hover:text-ssw-red focus:outline-none",
description ? "p-4" : "p-2",
)}
onClick={() => {
if (close) close();
}}
>
{(icon || iconImg) && (
<div className="flex shrink-0 items-center justify-center text-ssw-red">
<MegaIcon
className="h-6 w-6"
icon={icon as AvailableIcons}
iconImg={iconImg}
/>
</div>
)}

<div className="min-w-0 flex-1">
<span>
{name && description ? (
<>
<p className="font-bold">{name}</p>
<p className="mt-1 text-sm font-normal text-ssw-gray">
{description}
<div className="min-w-0 flex-1">
<span>
{name && description ? (
<>
<p className="font-bold">{name}</p>
<p className="mt-1 text-sm font-normal text-ssw-gray">
{description}
</p>
</>
) : (
<p className="pl-2 text-sm font-normal text-ssw-black hover:text-ssw-red">
{name}
</p>
</>
) : (
<p className="pl-2 text-sm font-normal text-ssw-black hover:text-ssw-red">
{name}
</p>
)}
</span>
</div>
</CustomLink>
<div className="ml-10 font-light text-ssw-gray flex flex-row gap-x-4 text-sm">

Check failure on line 163 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Invalid Tailwind CSS classnames order

Check failure on line 163 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `ont-light·text-ssw-gray·flex·flex-row·gap-x-4·text-sm` with `lex·flex-row·gap-x-4·text-sm·font-light·text-ssw-gray`
{youtubeLink && (

Check failure on line 164 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
<CustomLink

Check failure on line 165 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `··<CustomLink⏎··············href={youtubeLink}⏎··············className="hover:text-ssw-red"⏎············` with `<CustomLink·href={youtubeLink}·className="hover:text-ssw-red"`
href={youtubeLink}
className="hover:text-ssw-red"
>
YouTube

Check failure on line 169 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
</CustomLink>

Check failure on line 170 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
)}

Check failure on line 171 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `··········` with `········`
{documentationLink && (

Check failure on line 172 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
<CustomLink

Check failure on line 173 in lib/components/SubMenuGroup/SubMenuGroup.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `············<CustomLink⏎··············href={documentationLink}⏎··············className="hover:text-ssw-red"⏎············` with `··········<CustomLink·href={documentationLink}·className="hover:text-ssw-red"`
href={documentationLink}
className="hover:text-ssw-red"
>
Docs
</CustomLink>
)}
</span>
</div>
</CustomLink>
</div>
);
};

Expand Down
2 changes: 2 additions & 0 deletions lib/types/megamenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export interface NavMenuColumnGroupItem {
description?: string;
icon?: AvailableIcons | string;
iconImg?: string;
youtubeLink?: string;
documentationLink?: string;
}

export interface Sidebar {
Expand Down

0 comments on commit 8837bfa

Please sign in to comment.