import React, { useState } from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import Divider from '@material-ui/core/Divider';
import Grid from '@material-ui/core/Grid';
import Container from '@material-ui/core/Container';
import CssBaseline from '@material-ui/core/CssBaseline';
import Typography from '@material-ui/core/Typography';
import CheckboxGroup, { IOptions } from './index';
const DEFAULT_OPTIONS = [
{ label: 'First', value: 1 },
{ label: 'Second', value: 2, checked: true },
{ label: 'Third', value: 3 }
];
function ExampleWithElementsCount() {
// Selected values elements on boot
const [selected, changeSelected] = useState(
DEFAULT_OPTIONS.filter((d: IOptions) => d.checked && d.value).map(
(d: IOptions) => d.value
)
);
return (
changeSelected(checkedList)}
/>
Elements selected: {selected.join(', ')}
);
}
storiesOf('Data visualization', module).add('Checkbox group', () => (
Checkbox group
));