Skip to content

Commit

Permalink
Fix checkbox group (#972)
Browse files Browse the repository at this point in the history
* fix checkbox group

* change label style

Co-authored-by: Aniko Litvanyi <[email protected]>
  • Loading branch information
eniko.pusztai and herflis authored Oct 5, 2020
1 parent d52fee4 commit b35fb55
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/sensenet/src/components/field-controls/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @module FieldControls
*/
import { ChoiceFieldSetting } from '@sensenet/default-content-types'
import { Typography } from '@material-ui/core'
import Checkbox from '@material-ui/core/Checkbox'
import FormControl from '@material-ui/core/FormControl'
import FormControlLabel from '@material-ui/core/FormControlLabel'
Expand Down Expand Up @@ -41,7 +42,7 @@ export const CheckboxGroup: React.FC<ReactClientFieldSetting<ChoiceFieldSetting>
setState(newState)
props.fieldOnChange?.(
props.settings.Name,
newState.filter((item) => item.Selected),
newState.filter((item) => item.Selected).map((item) => item.Value),
)
}

Expand Down Expand Up @@ -75,7 +76,9 @@ export const CheckboxGroup: React.FC<ReactClientFieldSetting<ChoiceFieldSetting>
default: {
return props.fieldValue ? (
<FormControl component={'fieldset' as 'div'}>
<FormLabel component={'legend' as 'label'}>{props.settings.DisplayName}</FormLabel>
<Typography variant="caption" gutterBottom={true}>
{props.settings.DisplayName}
</Typography>
<FormGroup>
{Array.isArray(props.fieldValue) ? (
props.fieldValue.map((val: any, index: number) => (
Expand Down

0 comments on commit b35fb55

Please sign in to comment.