Skip to content

Commit

Permalink
refactor(VisuallyHidden): migrate component to typescript
Browse files Browse the repository at this point in the history
Refs: #6392
  • Loading branch information
Mousticke committed Jun 28, 2022
1 parent 4457e23 commit 8667a30
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react"
import PropTypes from "prop-types"
import styled from "styled-components"

// "Accessibility/SEO Friendly CSS Hiding"
Expand Down Expand Up @@ -33,15 +32,11 @@ const Container = styled.span`
}
`

const VisuallyHidden = (props) =>
props.isHidden ? <Container>{props.children}</Container> : props.children

VisuallyHidden.propTypes = {
isHidden: PropTypes.bool,
export interface IProps {
isHidden?: boolean
}

VisuallyHidden.defaultProps = {
isHidden: false,
}
const VisuallyHidden: React.FC<IProps> = ({ isHidden = false, children }) =>
isHidden ? <Container>{children}</Container> : <>children</>

export default VisuallyHidden

0 comments on commit 8667a30

Please sign in to comment.