mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 12:51:35 +02:00
[web] Add some unfilled material symbols GitOrigin-RevId: 2b5c477e6ff32f62ab40cacf666aeb98b311f126
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
import classNames from 'classnames'
|
|
import React from 'react'
|
|
import { bsVersion } from '@/features/utils/bootstrap-5'
|
|
|
|
// NOTE: When updating this list, make sure to update the bundled .woff2
|
|
// file as well. See details in material-symbols.css
|
|
export type AvailableUnfilledIcon =
|
|
| 'description'
|
|
| 'forum'
|
|
| 'integration_instructions'
|
|
| 'rate_review'
|
|
| 'report'
|
|
|
|
type BaseIconProps = React.ComponentProps<'i'> & {
|
|
accessibilityLabel?: string
|
|
modifier?: string
|
|
size?: '2x'
|
|
}
|
|
|
|
type FilledIconProps = BaseIconProps & {
|
|
type: string
|
|
unfilled?: false
|
|
}
|
|
|
|
type UnfilledIconProps = BaseIconProps & {
|
|
type: AvailableUnfilledIcon
|
|
unfilled: true
|
|
}
|
|
|
|
type IconProps = FilledIconProps | UnfilledIconProps
|
|
|
|
function MaterialIcon({
|
|
type,
|
|
className,
|
|
accessibilityLabel,
|
|
modifier,
|
|
size,
|
|
unfilled,
|
|
...rest
|
|
}: IconProps) {
|
|
const iconClassName = classNames('material-symbols', className, modifier, {
|
|
[`size-${size}`]: size,
|
|
unfilled,
|
|
})
|
|
|
|
return (
|
|
<>
|
|
<span className={iconClassName} aria-hidden="true" {...rest}>
|
|
{type}
|
|
</span>
|
|
{accessibilityLabel && (
|
|
<span className={bsVersion({ bs5: 'visually-hidden', bs3: 'sr-only' })}>
|
|
{accessibilityLabel}
|
|
</span>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default MaterialIcon
|