-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap Next.js’ Link component with our styles (as LinkInternal)
- Loading branch information
Sebastian Herrmann
committed
Aug 9, 2023
1 parent
41d7aae
commit 7260d21
Showing
1 changed file
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import styled from "@emotion/styled"; | ||
import styled, { CSSObject } from "@emotion/styled"; | ||
import NextLink from "next/link"; | ||
import { AnchorHTMLAttributes, ReactNode } from "react"; | ||
import { colors } from "../../common/styleVariables"; | ||
|
||
const A = styled.a({ | ||
const linkStyles: CSSObject = { | ||
color: colors.blueDark, | ||
textDecoration: "underline", | ||
"&:hover": { | ||
textDecoration: "none", | ||
}, | ||
}); | ||
}; | ||
const Link = styled.a<Props>(linkStyles); | ||
|
||
type Props = AnchorHTMLAttributes<HTMLAnchorElement> & { | ||
href: string; | ||
children: ReactNode; | ||
}; | ||
|
||
export default function Link(props: Props) { | ||
return <A {...props} />; | ||
} | ||
export default Link; | ||
|
||
export const LinkInternal = styled(NextLink)(linkStyles); |