2021-05-18 00:04:06 +00:00
|
|
|
import React, { useContext } from "react"
|
2021-04-29 14:58:31 +00:00
|
|
|
import BoxFull from "../base/BoxFull"
|
2021-05-18 14:23:54 +00:00
|
|
|
import BadgeCondition from "./BadgeCondition"
|
2021-04-29 14:58:31 +00:00
|
|
|
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
|
2021-05-18 00:04:06 +00:00
|
|
|
import ContextLanguage from "../../contexts/ContextLanguage"
|
2021-04-29 14:58:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-05-18 14:23:54 +00:00
|
|
|
* A box which renders all conditions of the {@link RepositoryEditor} as {@link BadgeCondition}s.
|
2021-04-29 14:58:31 +00:00
|
|
|
*
|
|
|
|
* @param props
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
export default function BoxConditions({ ...props }) {
|
2021-05-11 14:37:15 +00:00
|
|
|
const { conditions } = useRepositoryEditor()
|
2021-05-18 00:48:34 +00:00
|
|
|
const { strings } = useContext(ContextLanguage)
|
2021-04-29 14:58:31 +00:00
|
|
|
|
2021-05-22 02:57:38 +00:00
|
|
|
const badges = conditions.map((cond, pos) => <BadgeCondition key={pos} condition={cond}/>)
|
2021-04-29 14:58:31 +00:00
|
|
|
|
|
|
|
return (
|
2021-05-18 00:04:06 +00:00
|
|
|
<BoxFull header={strings.conditions} {...props}>
|
2021-04-29 14:58:31 +00:00
|
|
|
{badges}
|
|
|
|
</BoxFull>
|
|
|
|
)
|
|
|
|
}
|