2020-08-11 00:25:20 +02:00
|
|
|
import * as React from "react";
|
|
|
|
|
|
|
|
const cssStyle = require("./RadioButton.scss");
|
|
|
|
export const RadioButton = (props: {
|
2020-12-22 13:32:56 +01:00
|
|
|
children?: React.ReactNode | string | React.ReactNode[],
|
2020-08-11 00:25:20 +02:00
|
|
|
|
|
|
|
name: string,
|
|
|
|
selected: boolean,
|
|
|
|
|
|
|
|
disabled?: boolean
|
|
|
|
|
|
|
|
onChange: (checked: boolean) => void,
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<label>
|
|
|
|
<div className={cssStyle.container + " " + (props.disabled ? cssStyle.disabled : "")}>
|
|
|
|
<input
|
|
|
|
disabled={props.disabled}
|
|
|
|
type={"radio"}
|
|
|
|
name={props.name}
|
|
|
|
onChange={event => props.onChange(event.target.checked)}
|
|
|
|
checked={props.selected} />
|
|
|
|
<div className={cssStyle.mark} />
|
|
|
|
</div>
|
|
|
|
{props.children}
|
|
|
|
</label>
|
|
|
|
)
|
|
|
|
}
|