From 1903016f13b63e61a9fff1de7023b549c0c05f62 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Mon, 31 Aug 2020 11:55:20 +0200 Subject: [PATCH] Add "inline" option to RadioSet --- src/bootstrap/RadioSet.js | 19 +++++++++++++++---- src/bootstrap/Switch.js | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/RadioSet.js b/src/bootstrap/RadioSet.js index c9fede5..dbc5213 100644 --- a/src/bootstrap/RadioSet.js +++ b/src/bootstrap/RadioSet.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/) + * Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/) * * This is free software, licensed under the GNU General Public License v3. * See /LICENSE for more information. @@ -33,9 +33,18 @@ RadioSet.propTypes = { value: PropTypes.string, /** Help text message . */ helpText: PropTypes.string, + inline: PropTypes.bool, }; -export function RadioSet({ name, label, choices, value, helpText, ...props }) { +export function RadioSet({ + name, + label, + choices, + value, + helpText, + inline, + ...props +}) { const uid = useUID(); const radios = choices.map((choice, key) => { const id = `${name}-${key}`; @@ -48,6 +57,7 @@ export function RadioSet({ name, label, choices, value, helpText, ...props }) { value={choice.value} helpText={choice.helpText} checked={choice.value === value} + inline={inline} {...props} /> ); @@ -76,15 +86,16 @@ Radio.propTypes = { PropTypes.arrayOf(PropTypes.node), ]).isRequired, id: PropTypes.string.isRequired, + inline: PropTypes.bool, helpText: PropTypes.string, }; -export function Radio({ label, id, helpText, ...props }) { +export function Radio({ label, id, helpText, inline, ...props }) { return ( <>
+