From cce623f5b687aabd002560afa182e140eda21bcd Mon Sep 17 00:00:00 2001 From: ryanml Date: Thu, 2 Sep 2021 10:12:47 -0700 Subject: [PATCH] Fixing horizontal line for gas recommendations (#11890) * Fixing horizontal line for gas recommendations * Unify browser differences between Chrome and FF * Remove duplicate style * Remove browser hacks Co-authored-by: Elliot Winkler --- ui/components/ui/radio-group/index.scss | 48 +++++++++++++------ .../ui/radio-group/radio-group.component.js | 29 +++++++++-- 2 files changed, 58 insertions(+), 19 deletions(-) diff --git a/ui/components/ui/radio-group/index.scss b/ui/components/ui/radio-group/index.scss index 1d73d8afc..893ef09f4 100644 --- a/ui/components/ui/radio-group/index.scss +++ b/ui/components/ui/radio-group/index.scss @@ -20,33 +20,51 @@ height: 20px; } - &__column-line { + &__column-inner { + display: flex; + flex-direction: column; + align-items: center; + } + + &__column-line, + &__column-horizontal-line, + &__column-radio, + &__column-label { + flex: 1 1 auto; + } + + &__column-start-connector { + width: calc(50% + 0.5px); + height: 6px; + border-left: 1px solid $ui-2; + border-bottom: 1px solid $ui-2; + align-self: flex-end; + } + + &__column-end-connector { + width: calc(50% + 0.5px); + height: 6px; + border-right: 1px solid $ui-2; + border-bottom: 1px solid $ui-2; + align-self: flex-start; + } + + &__column-vertical-line { width: 1px; height: 5px; - background-color: $ui-2; - margin: 0 auto; + border-left: 1px solid $ui-2; } &__column-horizontal-line { height: 1px; - background-color: $ui-2; + border-bottom: 1px solid $ui-2; width: 100%; } - &__column:first-child &__column-horizontal-line { - width: 50px; - margin-left: 50px; - } - - &__column:last-child &__column-horizontal-line { - width: 51px; - } - &__column-radio { - margin-inline-end: 1px; - input { cursor: pointer; + margin: 0; } } diff --git a/ui/components/ui/radio-group/radio-group.component.js b/ui/components/ui/radio-group/radio-group.component.js index eb53782fc..7bc0dae6b 100644 --- a/ui/components/ui/radio-group/radio-group.component.js +++ b/ui/components/ui/radio-group/radio-group.component.js @@ -9,6 +9,25 @@ import { TYPOGRAPHY, } from '../../../helpers/constants/design-system'; +function Connector({ isFirst, isLast }) { + if (isFirst) { + return
; + } else if (isLast) { + return
; + } + return ( + <> +
+
+ + ); +} + +Connector.propTypes = { + isFirst: PropTypes.boolean, + isLast: PropTypes.boolean, +}; + export default function RadioGroup({ options, name, selectedValue, onChange }) { const t = useContext(I18nContext); @@ -22,11 +41,11 @@ export default function RadioGroup({ options, name, selectedValue, onChange }) { 'radio-group--has-recommendation': hasRecommendation, })} > - {options.map((option) => { + {options.map((option, index) => { const checked = option.value === selectedValue; return (
-
-
-
+