mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

Prevent browser translation of stuff that shouldn't be translated in project dashboard GitOrigin-RevId: aba5d28d368277730d3bdc9aced6b9257cbd7950
56 lines
1.1 KiB
TypeScript
56 lines
1.1 KiB
TypeScript
import classNames from 'classnames'
|
|
import React from 'react'
|
|
import unfilledIconTypes from '../../../fonts/material-symbols/unfilled-symbols.mjs'
|
|
|
|
export type AvailableUnfilledIcon = (typeof unfilledIconTypes)[number]
|
|
|
|
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"
|
|
translate="no"
|
|
{...rest}
|
|
>
|
|
{type}
|
|
</span>
|
|
{accessibilityLabel && (
|
|
<span className="visually-hidden">{accessibilityLabel}</span>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default MaterialIcon
|