PromucFlow_constructor/app/client/src/editorComponents/RadioGroupComponent.tsx

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-03-21 12:10:32 +00:00
import * as React from "react"
import { IComponentProps } from "./BaseComponent"
import { Radio, RadioGroup, IOptionProps } from "@blueprintjs/core"
import { Container } from "./ContainerComponent"
class RadioGroupComponent extends React.Component<IRadioGroupComponentProps> {
render() {
return (
<Container {...this.props}>
<RadioGroup
inline={this.props.inline}
label={this.props.label}
name={this.props.name}
onChange={this.props.handleRadioChange}
selectedValue={this.props.selectedValue}
disabled={this.props.disabled}
className={this.props.className}
options={this.props.options}
>
{this.props.items.map(item => (
<Radio label={item.label} value={item.value} />
))}
</RadioGroup>
</Container>
)
}
}
export interface IRadioGroupComponentProps extends IComponentProps {
label: string
inline: boolean
selectedValue: string | number
handleRadioChange: (event: React.FormEvent<HTMLInputElement>) => void
disabled: boolean
className: string
name: string
options: IOptionProps[]
items: Array<{
label: string
value: number | string
}>
}
export default RadioGroupComponent