Skip to content

Commit 8837bfa

Browse files
committed
Add YouTube and Docs conditional links
1 parent c4934a5 commit 8837bfa

File tree

2 files changed

+56
-34
lines changed

2 files changed

+56
-34
lines changed

lib/components/SubMenuGroup/SubMenuGroup.tsx

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -116,49 +116,69 @@ const MenuItem: React.FC<{
116116
};
117117

118118
const LinkItem: React.FC<{ link: NavMenuColumnGroupItem }> = ({
119-
link: { name, url, description, icon, iconImg },
119+
link: { name, url, description, icon, iconImg, youtubeLink, documentationLink },
120120
}) => {
121121
const close = useContext(ClosePopoverContext);
122122
const CustomLink = useLinkComponent();
123123

124124
return (
125-
<CustomLink
126-
href={url || ""}
127-
className={cx(
128-
"flex items-start gap-x-1 text-ssw-black hover:text-ssw-red focus:outline-none",
129-
description ? "p-4" : "p-2",
130-
)}
131-
onClick={() => {
132-
if (close) close();
133-
}}
134-
>
135-
{(icon || iconImg) && (
136-
<div className="flex shrink-0 items-center justify-center text-ssw-red">
137-
<MegaIcon
138-
className="h-6 w-6"
139-
icon={icon as AvailableIcons}
140-
iconImg={iconImg}
141-
/>
142-
</div>
143-
)}
125+
<div>
126+
<CustomLink
127+
href={url || ""}
128+
className={cx(
129+
"flex items-start gap-x-1 text-ssw-black hover:text-ssw-red focus:outline-none",
130+
description ? "p-4" : "p-2",
131+
)}
132+
onClick={() => {
133+
if (close) close();
134+
}}
135+
>
136+
{(icon || iconImg) && (
137+
<div className="flex shrink-0 items-center justify-center text-ssw-red">
138+
<MegaIcon
139+
className="h-6 w-6"
140+
icon={icon as AvailableIcons}
141+
iconImg={iconImg}
142+
/>
143+
</div>
144+
)}
144145

145-
<div className="min-w-0 flex-1">
146-
<span>
147-
{name && description ? (
148-
<>
149-
<p className="font-bold">{name}</p>
150-
<p className="mt-1 text-sm font-normal text-ssw-gray">
151-
{description}
146+
<div className="min-w-0 flex-1">
147+
<span>
148+
{name && description ? (
149+
<>
150+
<p className="font-bold">{name}</p>
151+
<p className="mt-1 text-sm font-normal text-ssw-gray">
152+
{description}
153+
</p>
154+
</>
155+
) : (
156+
<p className="pl-2 text-sm font-normal text-ssw-black hover:text-ssw-red">
157+
{name}
152158
</p>
153-
</>
154-
) : (
155-
<p className="pl-2 text-sm font-normal text-ssw-black hover:text-ssw-red">
156-
{name}
157-
</p>
159+
)}
160+
</span>
161+
</div>
162+
</CustomLink>
163+
<div className="ml-10 font-light text-ssw-gray flex flex-row gap-x-4 text-sm">
164+
{youtubeLink && (
165+
<CustomLink
166+
href={youtubeLink}
167+
className="hover:text-ssw-red"
168+
>
169+
YouTube
170+
</CustomLink>
171+
)}
172+
{documentationLink && (
173+
<CustomLink
174+
href={documentationLink}
175+
className="hover:text-ssw-red"
176+
>
177+
Docs
178+
</CustomLink>
158179
)}
159-
</span>
160180
</div>
161-
</CustomLink>
181+
</div>
162182
);
163183
};
164184

lib/types/megamenu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export interface NavMenuColumnGroupItem {
3131
description?: string;
3232
icon?: AvailableIcons | string;
3333
iconImg?: string;
34+
youtubeLink?: string;
35+
documentationLink?: string;
3436
}
3537

3638
export interface Sidebar {

0 commit comments

Comments
 (0)