Skip to content

Commit 8f57e73

Browse files
Refactor SkipLink.tsx component to use ChakraUI
1 parent 8791994 commit 8f57e73

File tree

1 file changed

+16
-28
lines changed

1 file changed

+16
-28
lines changed

src/components/SkipLink.tsx

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,31 @@
11
import React from "react"
2-
import styled from "@emotion/styled"
32
import Translation from "./Translation"
4-
5-
const Div = styled.div`
6-
background-color: ${(props) => props.theme.colors.primary};
7-
`
8-
9-
const Anchor = styled.a`
10-
line-height: 2rem;
11-
position: absolute;
12-
top: -3rem;
13-
margin-left: 0.5rem;
14-
color: ${(props) => props.theme.colors.background};
15-
text-decoration: none;
16-
17-
&:focus {
18-
position: static;
19-
}
20-
`
21-
22-
const DivAnchor = styled.div`
23-
height: 80px;
24-
margin-top: -80px;
25-
`
3+
import { Box, Link } from "@chakra-ui/react"
264

275
export interface IProps {
286
hrefId: string
297
}
308

319
export const SkipLink: React.FC<IProps> = ({ hrefId }) => {
3210
return (
33-
<Div>
34-
<Anchor href={hrefId}>
11+
<Box bg="primary">
12+
<Link
13+
href={hrefId}
14+
lineHeight="2rem"
15+
position="absolute"
16+
top="-3rem"
17+
ml=".5rem"
18+
color="background"
19+
textDecorationLine="none"
20+
_hover={{ textDecoration: "none" }}
21+
_focus={{ position: "static" }}
22+
>
3523
<Translation id="skip-to-main-content" />
36-
</Anchor>
37-
</Div>
24+
</Link>
25+
</Box>
3826
)
3927
}
4028

4129
export const SkipLinkAnchor: React.FC<{ id: string }> = ({ id }) => {
42-
return <DivAnchor id={id}></DivAnchor>
30+
return <Box height="80px" mt="-80px" id={id}></Box>
4331
}

0 commit comments

Comments
 (0)