Files
web/apps/scandic-web/components/Header/TopLink/index.tsx
Anton Gunnarsson f79ff9b570 Merged in chore/cleanup-unused (pull request #3461)
chore: Cleanup unused vars, exports, types

* Cleanup some unused exports

* Remove more

* Readd CampaignPageIncludedHotelsRef

* Add alias comment to procedure exports

* Remove unused exports


Approved-by: Linus Flood
2026-01-22 12:34:07 +00:00

42 lines
942 B
TypeScript

import { IconName } from "@scandic-hotels/design-system/Icons/iconName"
import HeaderLink from "../HeaderLink"
import styles from "./topLink.module.css"
import type { Header } from "@scandic-hotels/trpc/types/header"
import type { ComponentProps } from "react"
interface TopLinkProps extends Omit<
ComponentProps<typeof HeaderLink>,
"href" | "iconName" | "children"
> {
isLoggedIn: boolean
topLink: Header["header"]["topLink"]
iconSize?: number
}
export default function TopLink({
isLoggedIn,
topLink,
iconSize = 16,
...props
}: TopLinkProps) {
const linkData = isLoggedIn ? topLink.logged_in : topLink.logged_out
if (!linkData?.url || !linkData?.title) {
return null
}
return (
<HeaderLink
href={linkData.url}
iconName={linkData.icon || IconName.Gift}
iconSize={iconSize}
{...props}
>
<span className={styles.topLink}>{linkData.title}</span>
</HeaderLink>
)
}