Skip to content

Commit

Permalink
Wrap Next.js’ Link component with our styles (as LinkInternal)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Herrmann committed Aug 9, 2023
1 parent 41d7aae commit 7260d21
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/Link/index.tsx
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);

0 comments on commit 7260d21

Please sign in to comment.