Change navigation headline to allow href attributes
This commit is contained in:
parent
ad183bbc0e
commit
c414b7d1f2
@ -15,17 +15,25 @@ const Link = styled(RouterLink)({
|
|||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
});
|
});
|
||||||
|
|
||||||
type NavigationHeadlineProps = Partial<Pick<RouterLinkProps, "to">>;
|
type NavigationHeadlineProps =
|
||||||
|
| (Partial<Pick<RouterLinkProps, "to">> & {
|
||||||
|
href?: undefined;
|
||||||
|
})
|
||||||
|
| {
|
||||||
|
href?: string;
|
||||||
|
to?: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
const NavigationHeadline: React.FC<
|
const NavigationHeadline: React.FC<
|
||||||
React.PropsWithChildren<NavigationHeadlineProps>
|
React.PropsWithChildren<NavigationHeadlineProps>
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { children, to } = props;
|
const { children, href, to } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Headline>
|
<Headline>
|
||||||
{to && <Link to={to}>{children}</Link>}
|
{to && <Link to={to}>{children}</Link>}
|
||||||
{!to && children}
|
{href && <a href={href}>{children}</a>}
|
||||||
|
{!to && !href && children}
|
||||||
</Headline>
|
</Headline>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user