mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 09:33:58 -05:00
f065a7a909
GitOrigin-RevId: fbb23b32c47edbe5a22badc627318accbd09e82a
51 lines
969 B
JavaScript
51 lines
969 B
JavaScript
import PropTypes from 'prop-types'
|
|
import classNames from 'classnames'
|
|
|
|
/**
|
|
* @param {string} type
|
|
* @param {boolean} [spin]
|
|
* @param {boolean} [fw]
|
|
* @param {string} [modifier]
|
|
* @param {string} [className]
|
|
* @param {string} [accessibilityLabel]
|
|
* @return {JSX.Element}
|
|
*/
|
|
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
|