import { makeStyles } from '@material-ui/core/styles' import React, { useState, memo } from 'react' import { Link } from 'src/components/buttons' import { RadioGroup } from 'src/components/inputs' import { Table, TableBody, TableRow, TableCell } from 'src/components/table' import BooleanCell from 'src/components/tables/BooleanCell' import { H4 } from 'src/components/typography' import { ReactComponent as EditIconDisabled } from 'src/styling/icons/action/edit/disabled.svg' import { ReactComponent as EditIcon } from 'src/styling/icons/action/edit/enabled.svg' import { booleanPropertiesTableStyles } from './BooleanPropertiesTable.styles' const useStyles = makeStyles(booleanPropertiesTableStyles) const BooleanPropertiesTable = memo( ({ title, disabled, data, elements, save }) => { const [editing, setEditing] = useState(false) const [radioGroupValues, setRadioGroupValues] = useState(elements) const classes = useStyles() const innerSave = () => { radioGroupValues.forEach(element => { data[element.name] = element.value }) save(data) setEditing(false) } const innerCancel = () => { setEditing(false) } const handleRadioButtons = (elementName, newValue) => { setRadioGroupValues( radioGroupValues.map(element => element.name === elementName ? { ...element, value: newValue } : element ) ) } const radioButtonOptions = [ { label: 'Yes', value: true }, { label: 'No', value: false } ] if (!elements || radioGroupValues?.length === 0) return null return (