mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
49 lines
916 B
JavaScript
49 lines
916 B
JavaScript
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import classNames from 'classnames'
|
|
|
|
function Icon({
|
|
type,
|
|
spin,
|
|
modifier,
|
|
classes = {},
|
|
accessibilityLabel,
|
|
children,
|
|
}) {
|
|
const iconClassName = classNames(
|
|
'fa',
|
|
`fa-${type}`,
|
|
{
|
|
'fa-spin': spin,
|
|
[`fa-${modifier}`]: modifier,
|
|
},
|
|
classes.icon
|
|
)
|
|
|
|
return (
|
|
<>
|
|
<i className={iconClassName} aria-hidden="true">
|
|
{children}
|
|
</i>
|
|
{accessibilityLabel ? (
|
|
<span className="sr-only">{accessibilityLabel}</span>
|
|
) : null}
|
|
</>
|
|
)
|
|
}
|
|
|
|
Icon.propTypes = {
|
|
type: PropTypes.string.isRequired,
|
|
spin: PropTypes.bool,
|
|
modifier: PropTypes.string,
|
|
classes: PropTypes.exact({
|
|
icon: PropTypes.string,
|
|
}),
|
|
accessibilityLabel: PropTypes.string,
|
|
children: PropTypes.oneOfType([
|
|
PropTypes.arrayOf(PropTypes.node),
|
|
PropTypes.node,
|
|
]),
|
|
}
|
|
|
|
export default Icon
|