You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
homepage/src/components/services/widget/container.jsx

17 lines
499 B

import Error from "./error";
export default function Container({ error = false, children, service }) {
if (error) {
return <Error error={error} />
}
let visibleChildren = children;
const fields = service?.widget?.fields;
const type = service?.widget?.type;
if (fields && type) {
visibleChildren = children.filter(child => fields.some(field => `${type}.${field}` === child?.props?.label));
}
return <div className="relative flex flex-row w-full">{visibleChildren}</div>;
}