Skip to content

Commit 56b33ab

Browse files
authored
Merge pull request #8602 from MahendraBishnoi29/patch-2
Refactor `SkipLink.tsx` component to use ChakraUI
2 parents 08732eb + 49bd54c commit 56b33ab

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

src/components/SkipLink.tsx

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,33 @@
11
import React from "react"
2-
import styled from "@emotion/styled"
3-
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;
2+
import { Box } from "@chakra-ui/react"
163

17-
&:focus {
18-
position: static;
19-
}
20-
`
21-
22-
const DivAnchor = styled.div`
23-
height: 80px;
24-
margin-top: -80px;
25-
`
4+
import Translation from "./Translation"
5+
import Link from "../components/Link"
266

277
export interface IProps {
288
hrefId: string
299
}
3010

3111
export const SkipLink: React.FC<IProps> = ({ hrefId }) => {
3212
return (
33-
<Div>
34-
<Anchor href={hrefId}>
13+
<Box bg="primary">
14+
<Link
15+
href={hrefId}
16+
lineHeight="taller"
17+
position="absolute"
18+
top="-12"
19+
ml="2"
20+
color="background"
21+
textDecorationLine="none"
22+
_hover={{ textDecoration: "none" }}
23+
_focus={{ position: "static" }}
24+
>
3525
<Translation id="skip-to-main-content" />
36-
</Anchor>
37-
</Div>
26+
</Link>
27+
</Box>
3828
)
3929
}
4030

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

0 commit comments

Comments
 (0)