feat(SW-572): Added support for logged in and logged out variants of the top link inside the header
This commit is contained in:
26
components/Header/TopLink/index.tsx
Normal file
26
components/Header/TopLink/index.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import HeaderLink from "../HeaderLink"
|
||||
|
||||
import type { TopLinkProps } from "@/types/components/header/topLink"
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default function TopLink({
|
||||
isLoggedIn,
|
||||
topLink,
|
||||
iconSize = 16,
|
||||
}: TopLinkProps) {
|
||||
const linkData = isLoggedIn ? topLink.logged_in : topLink.logged_out
|
||||
|
||||
if (!linkData?.link?.url || !linkData?.title) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<HeaderLink
|
||||
href={linkData.link.url}
|
||||
iconName={linkData.icon || IconName.Gift}
|
||||
iconSize={iconSize}
|
||||
>
|
||||
{linkData.title}
|
||||
</HeaderLink>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user