Commit b23b356e authored by Jure's avatar Jure

Merge branch 'readonly-ui-components' into 'master'

feat(ui): add option to disable radio and checkbox

See merge request pubsweet/pubsweet!366
parents 69265199 ff9644ab
Pipeline #8542 passed with stages
in 14 minutes and 35 seconds
......@@ -23,6 +23,8 @@ const Root = styled.label`
`
const Checkbox = ({
className,
disabled,
inline,
name,
value,
......@@ -34,9 +36,10 @@ const Checkbox = ({
checked = checked || false
return (
<Root checked={checked} inline={inline}>
<Root checked={checked} className={className} inline={inline}>
<Input
checked={checked}
disabled={disabled}
name={name}
onChange={onChange}
required={required}
......
......@@ -21,6 +21,7 @@ const Root = styled.label`
`
const Radio = ({
className,
disabled,
color,
inline,
name,
......@@ -29,12 +30,11 @@ const Radio = ({
checked,
required,
onChange,
readonly,
}) => (
<Root checked={checked} color={color} inline={inline}>
<Root checked={checked} className={className} color={color} inline={inline}>
<Input
checked={checked}
disabled={readonly}
disabled={disabled}
name={name}
onChange={onChange}
required={required}
......
......@@ -18,7 +18,7 @@ class RadioGroup extends React.Component {
}
render() {
const { inline, name, options, required } = this.props
const { className, disabled, inline, name, options, required } = this.props
const { value } = this.state
return (
......@@ -26,7 +26,9 @@ class RadioGroup extends React.Component {
{options.map(option => (
<Radio
checked={option.value === value}
className={className}
color={option.color}
disabled={disabled}
inline={inline}
key={option.value}
label={option.label}
......
......@@ -41,6 +41,7 @@ exports[`Checkbox Group is rendered correctly 1`] = `
<input
checked={false}
className=""
disabled={undefined}
name={undefined}
onChange={[Function]}
required={undefined}
......@@ -61,6 +62,7 @@ exports[`Checkbox Group is rendered correctly 1`] = `
<input
checked={false}
className=""
disabled={undefined}
name={undefined}
onChange={[Function]}
required={undefined}
......@@ -81,6 +83,7 @@ exports[`Checkbox Group is rendered correctly 1`] = `
<input
checked={false}
className=""
disabled={undefined}
name={undefined}
onChange={[Function]}
required={undefined}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment