Skip to content

Commit

Permalink
VisuallyHidden
Browse files Browse the repository at this point in the history
  • Loading branch information
lerte committed Nov 12, 2024
1 parent e9402ad commit e0cab5c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
16 changes: 9 additions & 7 deletions packages/actify/src/components/VisuallyHidden/VisuallyHidden.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { VisuallyHiddenProps, useVisuallyHidden } from 'react-aria'

import React from 'react'
import styles from './actify.module.css'
import styles from './visually-hidden.module.css'

interface CompProps {
as?: keyof React.JSX.IntrinsicElements
interface Props extends VisuallyHiddenProps {
as?: keyof HTMLElementTagNameMap | React.ElementType
}
const VisuallyHidden: React.FC<
CompProps & React.HTMLAttributes<HTMLOrSVGElement>
> = ({ as: Tag = 'span', ...rest }) => {
return <Tag className={styles['visually-hidden']} {...rest} />
const VisuallyHidden = ({ as: Tag = 'span', ...props }: Props) => {
const { visuallyHiddenProps } = useVisuallyHidden(props)

return <Tag className={styles['visually-hidden']} {...visuallyHiddenProps} />
}

export { VisuallyHidden }
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.visually-hidden {
/* https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss */
position: absolute;
border: 0;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
}
.visually-hidden {
/* https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss */
position: absolute;
border: 0;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
}

0 comments on commit e0cab5c

Please sign in to comment.