2019-09-05 17:47:50 +00:00
|
|
|
import * as React from "react";
|
|
|
|
|
import { ComponentProps } from "./BaseComponent";
|
|
|
|
|
import { Checkbox } from "@blueprintjs/core";
|
|
|
|
|
import { Container } from "./ContainerComponent";
|
2019-09-09 09:08:54 +00:00
|
|
|
class CheckboxComponent extends React.Component<CheckboxComponentProps> {
|
2019-03-21 12:10:32 +00:00
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<Container {...this.props}>
|
|
|
|
|
{this.props.items.map(item => (
|
|
|
|
|
<Checkbox
|
2019-09-09 09:08:54 +00:00
|
|
|
key={item.key}
|
2019-03-21 12:10:32 +00:00
|
|
|
label={item.label}
|
|
|
|
|
defaultIndeterminate={item.defaultIndeterminate}
|
|
|
|
|
value={item.value}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</Container>
|
2019-09-05 17:47:50 +00:00
|
|
|
);
|
2019-03-21 12:10:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-09 09:08:54 +00:00
|
|
|
export interface CheckboxComponentProps extends ComponentProps {
|
2019-03-21 12:10:32 +00:00
|
|
|
items: Array<{
|
2019-09-09 09:08:54 +00:00
|
|
|
key: string;
|
2019-09-05 17:47:50 +00:00
|
|
|
label: string;
|
|
|
|
|
defaultIndeterminate: boolean;
|
|
|
|
|
value: number | string;
|
|
|
|
|
}>;
|
2019-03-21 12:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 17:47:50 +00:00
|
|
|
export default CheckboxComponent;
|