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",
|
||||
});
|
||||
|
||||
type NavigationHeadlineProps = Partial<Pick<RouterLinkProps, "to">>;
|
||||
type NavigationHeadlineProps =
|
||||
| (Partial<Pick<RouterLinkProps, "to">> & {
|
||||
href?: undefined;
|
||||
})
|
||||
| {
|
||||
href?: string;
|
||||
to?: undefined;
|
||||
};
|
||||
|
||||
const NavigationHeadline: React.FC<
|
||||
React.PropsWithChildren<NavigationHeadlineProps>
|
||||
> = (props) => {
|
||||
const { children, to } = props;
|
||||
const { children, href, to } = props;
|
||||
|
||||
return (
|
||||
<Headline>
|
||||
{to && <Link to={to}>{children}</Link>}
|
||||
{!to && children}
|
||||
{href && <a href={href}>{children}</a>}
|
||||
{!to && !href && children}
|
||||
</Headline>
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user