digitransit-ui/app/component/IconWithBigCaution.js
2025-04-08 08:57:19 +03:00

43 lines
1.1 KiB
JavaScript

import PropTypes from 'prop-types';
import React from 'react';
import IconWithIcon from './IconWithIcon';
import { AlertSeverityLevelType } from '../constants';
export default function IconWithBigCaution({
alertSeverityLevel,
className,
color,
img,
}) {
const iconType =
alertSeverityLevel === AlertSeverityLevelType.Info
? 'info'
: 'caution-no-excl';
const subIconClassName =
alertSeverityLevel === AlertSeverityLevelType.Info ? 'info' : 'caution';
return (
<IconWithIcon
className={className}
color={color}
img={img}
subIcon={`icon-icon_${iconType}`}
subIconClassName={`subicon-${subIconClassName}`}
subIconShape={(iconType === 'info' && 'circle') || undefined}
/>
);
}
IconWithBigCaution.displayName = 'IconWithBigCaution';
IconWithBigCaution.propTypes = {
alertSeverityLevel: PropTypes.string,
color: PropTypes.string,
className: PropTypes.string,
img: PropTypes.string.isRequired,
};
IconWithBigCaution.defaultProps = {
alertSeverityLevel: undefined,
className: '',
color: undefined,
};