mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fa3f51fb2e
[web] - Updating the Account Settings page with the Button and Icon Button wrappers GitOrigin-RevId: 135c4ddaa64d009d3ab8cdfef9cff899fd77669c
47 lines
888 B
TypeScript
47 lines
888 B
TypeScript
import classNames from 'classnames'
|
|
import { bsVersion } from '@/features/utils/bootstrap-5'
|
|
|
|
type IconOwnProps = {
|
|
type: string
|
|
spin?: boolean
|
|
fw?: boolean
|
|
modifier?: string
|
|
accessibilityLabel?: string
|
|
}
|
|
|
|
export 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={bsVersion({ bs5: 'visually-hidden', bs3: 'sr-only' })}>
|
|
{accessibilityLabel}
|
|
</span>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Icon
|