Repository URL to install this package:
|
Version:
3.0.6-working.1 ▾
|
import React from 'react'
import { MaterialIconProps } from './typings'
import { defaultRenderIcon, defaultWrapper } from './renderProps'
import { defaultPathAliases, defaultPaths } from './paths'
class MaterialIcon extends React.PureComponent<MaterialIconProps> {
static defaultProps = {
type: 'empty',
isDisabled: false,
isSelected: false,
nowrap: false,
renderIcon: defaultRenderIcon,
renderWrapper: defaultWrapper,
pathAliases: defaultPathAliases,
paths: defaultPaths,
}
render() {
const {
className,
renderIcon,
renderWrapper,
type,
isDisabled,
isSelected,
onClick,
} = this.props
const label = type + ' icon'
const icon = renderIcon(this.props)
const attributes = {
className,
type,
isDisabled,
isSelected,
isInteractive: onClick !== undefined,
'aria-disabled': isDisabled,
'aria-label': label,
}
return renderWrapper(this.props, attributes, icon)
}
}
export { MaterialIcon }
export default MaterialIcon