File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 1
- import React from "react "
1
+ import { useTranslation } from "next-i18next "
2
2
import { Box } from "@chakra-ui/react"
3
3
4
- import { BaseLink } from "../components/Link "
4
+ import { MAIN_CONTENT_ID } from "@/lib/constants "
5
5
6
- import Translation from "./Translation "
6
+ import { Button } from "./Buttons "
7
7
8
- export interface IProps {
9
- hrefId : string
10
- }
8
+ export const SkipLink = ( ) => {
9
+ const { t } = useTranslation ( "common" )
11
10
12
- export const SkipLink : React . FC < IProps > = ( { hrefId } ) => {
11
+ const handleNavigate = ( ) => {
12
+ document ?. getElementById ( MAIN_CONTENT_ID ) ?. focus ( )
13
+ }
13
14
return (
14
15
< Box bg = "primary.base" >
15
- < BaseLink
16
- href = { hrefId }
16
+ < Button
17
+ h = "8"
18
+ onClick = { handleNavigate }
17
19
lineHeight = "taller"
18
20
position = "absolute"
19
21
top = "-12"
@@ -23,8 +25,8 @@ export const SkipLink: React.FC<IProps> = ({ hrefId }) => {
23
25
_hover = { { textDecoration : "none" } }
24
26
_focus = { { position : "static" } }
25
27
>
26
- < Translation id = "skip-to-main-content" />
27
- </ BaseLink >
28
+ { t ( "skip-to-main-content" ) }
29
+ </ Button >
28
30
</ Box >
29
31
)
30
32
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { Root } from "@/lib/interfaces"
9
9
import FeedbackWidget from "@/components/FeedbackWidget"
10
10
import Footer from "@/components/Footer"
11
11
import Nav from "@/components/Nav"
12
+ import { SkipLink } from "@/components/SkipLink"
12
13
import TranslationBanner from "@/components/TranslationBanner"
13
14
import TranslationBannerLegal from "@/components/TranslationBannerLegal"
14
15
@@ -45,6 +46,8 @@ export const RootLayout = ({
45
46
46
47
return (
47
48
< Container mx = "auto" maxW = { oldTheme . variables . maxPageWidth } >
49
+ < SkipLink />
50
+
48
51
< Nav path = { asPath } />
49
52
50
53
< TranslationBanner
Original file line number Diff line number Diff line change 89
89
" ./src/components/SideNavMobile.tsx" ,
90
90
" ./src/components/SimpleTable.tsx" ,
91
91
" ./src/components/Simulator" ,
92
- " ./src/components/SkipLink.tsx" ,
93
92
" ./src/components/Slider/Slider.stories.tsx" ,
94
93
" ./src/components/Slider/index.tsx" ,
95
94
" ./src/components/StablecoinAccordion/AccordionCustomItem.tsx" ,
You can’t perform that action at this time.
0 commit comments