import React from 'react';
import { Checkbox } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';
// note: treat checkbox group the same as a nested component, using `path`
const CheckboxGroupComponent = ({ refFunction, path, value, updateCurrentValues, inputProperties }) => (
{inputProperties.options.map((option, i) => (
{
// give each individual checkbox its own path
const checkboxPath = `${path}.${i}`;
if (isChecked) {
updateCurrentValues({ [checkboxPath]: option.value });
} else {
updateCurrentValues({ [checkboxPath]: null });
}
}}
/>
))}
);
registerComponent('FormComponentCheckboxGroup', CheckboxGroupComponent);