mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 05:51:04 +00:00
f175aef078
GitOrigin-RevId: 5b5bc5d2f9e5361e868cc6c9560f28a872d90ae1
42 lines
759 B
JavaScript
42 lines
759 B
JavaScript
import PropTypes from 'prop-types'
|
|
import classNames from 'classnames'
|
|
|
|
function Icon({
|
|
type,
|
|
spin,
|
|
fw,
|
|
modifier,
|
|
className = '',
|
|
accessibilityLabel,
|
|
}) {
|
|
const iconClassName = classNames(
|
|
'fa',
|
|
`fa-${type}`,
|
|
{
|
|
'fa-spin': spin,
|
|
'fa-fw': fw,
|
|
[`fa-${modifier}`]: modifier,
|
|
},
|
|
className
|
|
)
|
|
|
|
return (
|
|
<>
|
|
<i className={iconClassName} aria-hidden="true" />
|
|
{accessibilityLabel && (
|
|
<span className="sr-only">{accessibilityLabel}</span>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
Icon.propTypes = {
|
|
type: PropTypes.string.isRequired,
|
|
spin: PropTypes.bool,
|
|
fw: PropTypes.bool,
|
|
modifier: PropTypes.string,
|
|
className: PropTypes.string,
|
|
accessibilityLabel: PropTypes.string,
|
|
}
|
|
|
|
export default Icon
|