Web: Components: RadioButtonGroup: add text label

This commit is contained in:
Viktor Fomin 2022-03-31 01:09:51 +03:00
parent 227821700b
commit 99c441688d
2 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import React from "react";
import PropTypes from "prop-types";
import RadioButton from "../radio-button";
import StyledDiv from "./styled-radio-button-group";
import Text from "../text";
class RadioButtonGroup extends React.Component {
constructor(props) {
@ -36,6 +37,12 @@ class RadioButtonGroup extends React.Component {
width={this.props.width}
>
{options.map((option) => {
if (option.type === "text")
return (
<Text key="radio-text" className="subtext">
{option.label}
</Text>
);
return (
<RadioButton
key={option.value}

View File

@ -5,6 +5,11 @@ import styled, { css } from "styled-components";
const ClearDiv = ({ orientation, width, ...props }) => <div {...props} />;
const StyledDiv = styled(ClearDiv)`
.subtext {
margin-top: 16px;
margin-bottom: 8px;
}
${(props) =>
(props.orientation === "horizontal" &&
css`