2021-04-29 03:03:58 +00:00
|
|
|
import React, { useContext } from "react"
|
2021-05-25 02:39:48 +00:00
|
|
|
import ContextRepositoryEditor from "../../contexts/ContextConditionEditor"
|
2021-05-18 14:23:54 +00:00
|
|
|
import Badge from "../base/Badge"
|
2021-04-29 02:27:06 +00:00
|
|
|
|
|
|
|
|
2021-04-29 03:03:58 +00:00
|
|
|
/**
|
2021-05-22 02:57:38 +00:00
|
|
|
* A {@link Badge} representing a {@link Condition}.
|
2021-04-29 03:03:58 +00:00
|
|
|
*
|
2021-05-22 02:57:38 +00:00
|
|
|
* @param condition - The {@link Condition} that this badge represents.
|
2021-04-29 03:03:58 +00:00
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2021-05-22 02:57:38 +00:00
|
|
|
export default function BadgeCondition({ condition }) {
|
2021-05-11 14:37:15 +00:00
|
|
|
const { removeRawCondition } = useContext(ContextRepositoryEditor)
|
2021-04-29 03:03:58 +00:00
|
|
|
|
2021-04-29 02:27:06 +00:00
|
|
|
return (
|
2021-05-18 14:23:54 +00:00
|
|
|
<Badge
|
2021-05-22 02:57:38 +00:00
|
|
|
{...condition.display()}
|
|
|
|
onClickDelete={() => removeRawCondition(condition)}
|
|
|
|
/>
|
2021-04-29 02:27:06 +00:00
|
|
|
)
|
|
|
|
}
|