1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-30 00:14:19 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/BoxConditions.js
2021-05-18 02:48:34 +02:00

26 lines
785 B
JavaScript

import React, { useContext } from "react"
import BoxFull from "../base/BoxFull"
import ConditionBadge from "./ConditionBadge"
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import ContextLanguage from "../../contexts/ContextLanguage"
/**
* A box which renders all conditions of the {@link RepositoryEditor} as {@link ConditionBadge}s.
*
* @param props
* @returns {JSX.Element}
* @constructor
*/
export default function BoxConditions({ ...props }) {
const { conditions } = useRepositoryEditor()
const { strings } = useContext(ContextLanguage)
const badges = conditions.map((cond, pos) => <ConditionBadge key={pos} {...cond}/>)
return (
<BoxFull header={strings.conditions} {...props}>
{badges}
</BoxFull>
)
}