web2019/static/js/shop/CardWarnings.jsx
Egor Savkin 63d83b5e10 Add other warnings for the cards
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-01-09 10:14:53 +08:00

39 lines
1.2 KiB
JavaScript

import {OverlayTrigger} from "react-bootstrap";
import React from "react";
import {MaxLevel} from "./warnings";
export function CardWarnings({warnings, prefix}) {
const max_level = MaxLevel(warnings);
return (
<OverlayTrigger
placement="bottom"
trigger={['click', 'hover', 'focus']}
overlay={
({arrowProps, hasDoneInitialMeasure, show, ...props}) => (
<div className="k-popup-warning" {...props}>
{warnings.map((warning, _i) => {
return (
<p className="rule warning" key={`warnmsg_${prefix}_${warning.name}`}>
<i>{warning.message}</i>
</p>
)
})}
</div>)
}
rootClose
>
<img className="alert-warning" src={max_level.icon}/>
</OverlayTrigger>
)
}
export function WarningIndicator({warnings}) {
const max_level = MaxLevel(warnings);
return (
<img
className="alert-warning align-self-start"
src={max_level.icon}
/>
)
}