2020-09-21 10:14:36 -04:00
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import classNames from 'classnames'
|
|
|
|
|
2020-11-26 09:22:30 -05:00
|
|
|
function Icon({
|
|
|
|
type,
|
|
|
|
spin,
|
2022-01-19 06:56:57 -05:00
|
|
|
fw,
|
2020-11-26 09:22:30 -05:00
|
|
|
modifier,
|
2022-01-19 06:56:57 -05:00
|
|
|
className = '',
|
2020-11-26 09:22:30 -05:00
|
|
|
accessibilityLabel,
|
|
|
|
}) {
|
2020-09-21 10:14:36 -04:00
|
|
|
const iconClassName = classNames(
|
|
|
|
'fa',
|
|
|
|
`fa-${type}`,
|
|
|
|
{
|
|
|
|
'fa-spin': spin,
|
2022-01-19 06:56:57 -05:00
|
|
|
'fa-fw': fw,
|
2021-04-27 03:52:58 -04:00
|
|
|
[`fa-${modifier}`]: modifier,
|
2020-09-21 10:14:36 -04:00
|
|
|
},
|
2022-01-19 06:56:57 -05:00
|
|
|
className
|
2020-09-21 10:14:36 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2022-01-19 06:56:57 -05:00
|
|
|
<i className={iconClassName} aria-hidden="true" />
|
|
|
|
{accessibilityLabel && (
|
2020-09-21 10:14:36 -04:00
|
|
|
<span className="sr-only">{accessibilityLabel}</span>
|
2022-01-19 06:56:57 -05:00
|
|
|
)}
|
2020-09-21 10:14:36 -04:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
Icon.propTypes = {
|
|
|
|
type: PropTypes.string.isRequired,
|
|
|
|
spin: PropTypes.bool,
|
2022-01-19 06:56:57 -05:00
|
|
|
fw: PropTypes.bool,
|
2020-09-21 10:14:36 -04:00
|
|
|
modifier: PropTypes.string,
|
2022-01-19 06:56:57 -05:00
|
|
|
className: PropTypes.string,
|
2020-11-26 09:22:30 -05:00
|
|
|
accessibilityLabel: PropTypes.string,
|
2020-09-21 10:14:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Icon
|