mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 15:02:25 -05:00
a0fabee3b4
[Integration branch] Project Dashboard React Migration GitOrigin-RevId: 3c3db39109a8137c57995f5f7c0ff8c800f04c4e
44 lines
758 B
TypeScript
44 lines
758 B
TypeScript
import classNames from 'classnames'
|
|
|
|
type IconOwnProps = {
|
|
type: string
|
|
spin?: boolean
|
|
fw?: boolean
|
|
modifier?: string
|
|
accessibilityLabel?: string
|
|
}
|
|
|
|
type IconProps = IconOwnProps &
|
|
Omit<React.ComponentProps<'i'>, keyof IconOwnProps>
|
|
|
|
function Icon({
|
|
type,
|
|
spin,
|
|
fw,
|
|
modifier,
|
|
className = '',
|
|
accessibilityLabel,
|
|
...rest
|
|
}: IconProps) {
|
|
const iconClassName = classNames(
|
|
'fa',
|
|
`fa-${type}`,
|
|
{
|
|
'fa-spin': spin,
|
|
'fa-fw': fw,
|
|
[`fa-${modifier}`]: modifier,
|
|
},
|
|
className
|
|
)
|
|
|
|
return (
|
|
<>
|
|
<i className={iconClassName} aria-hidden="true" {...rest} />
|
|
{accessibilityLabel && (
|
|
<span className="sr-only">{accessibilityLabel}</span>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Icon
|