forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSkipLink.js
More file actions
36 lines (34 loc) · 688 Bytes
/
SkipLink.js
File metadata and controls
36 lines (34 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/** @jsx jsx */
import PropTypes from 'prop-types'
import { css, jsx } from '@emotion/react'
import { Link } from '@chakra-ui/react'
const makeInvisible = css`
left: -999px;
position: absolute;
top: auto;
overflow: hidden;
z-index: -999;
:focus,
:active {
background-color: white;
left: auto;
top: auto;
height: auto;
overflow: auto;
z-index: 999;
}
`
export const SkipLink = ({ invisible, ...rest }) => (
<Link
backgroundColor="white"
css={invisible ? makeInvisible : null}
aria-label="Skip to main Content"
{...rest}
/>
)
SkipLink.defaultProps = {
invisible: false,
}
SkipLink.propTypes = {
invisible: PropTypes.bool,
}