mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
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 <elliot.winkler@gmail.com>
This commit is contained in:
parent
8d9989cea0
commit
cce623f5b6
@ -20,33 +20,51 @@
|
|||||||
height: 20px;
|
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;
|
width: 1px;
|
||||||
height: 5px;
|
height: 5px;
|
||||||
background-color: $ui-2;
|
border-left: 1px solid $ui-2;
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__column-horizontal-line {
|
&__column-horizontal-line {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background-color: $ui-2;
|
border-bottom: 1px solid $ui-2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__column:first-child &__column-horizontal-line {
|
|
||||||
width: 50px;
|
|
||||||
margin-left: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__column:last-child &__column-horizontal-line {
|
|
||||||
width: 51px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__column-radio {
|
&__column-radio {
|
||||||
margin-inline-end: 1px;
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,25 @@ import {
|
|||||||
TYPOGRAPHY,
|
TYPOGRAPHY,
|
||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
|
|
||||||
|
function Connector({ isFirst, isLast }) {
|
||||||
|
if (isFirst) {
|
||||||
|
return <div className="radio-group__column-start-connector" />;
|
||||||
|
} else if (isLast) {
|
||||||
|
return <div className="radio-group__column-end-connector" />;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="radio-group__column-vertical-line" />
|
||||||
|
<div className="radio-group__column-horizontal-line" />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Connector.propTypes = {
|
||||||
|
isFirst: PropTypes.boolean,
|
||||||
|
isLast: PropTypes.boolean,
|
||||||
|
};
|
||||||
|
|
||||||
export default function RadioGroup({ options, name, selectedValue, onChange }) {
|
export default function RadioGroup({ options, name, selectedValue, onChange }) {
|
||||||
const t = useContext(I18nContext);
|
const t = useContext(I18nContext);
|
||||||
|
|
||||||
@ -22,11 +41,11 @@ export default function RadioGroup({ options, name, selectedValue, onChange }) {
|
|||||||
'radio-group--has-recommendation': hasRecommendation,
|
'radio-group--has-recommendation': hasRecommendation,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{options.map((option) => {
|
{options.map((option, index) => {
|
||||||
const checked = option.value === selectedValue;
|
const checked = option.value === selectedValue;
|
||||||
return (
|
return (
|
||||||
<div className="radio-group__column" key={`${name}-${option.value}`}>
|
<div className="radio-group__column" key={`${name}-${option.value}`}>
|
||||||
<label>
|
<label className="radio-group__column-inner">
|
||||||
{hasRecommendation && (
|
{hasRecommendation && (
|
||||||
<Typography
|
<Typography
|
||||||
color={COLORS.SUCCESS3}
|
color={COLORS.SUCCESS3}
|
||||||
@ -45,8 +64,10 @@ export default function RadioGroup({ options, name, selectedValue, onChange }) {
|
|||||||
onChange={() => onChange?.(option.value)}
|
onChange={() => onChange?.(option.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="radio-group__column-line"></div>
|
<Connector
|
||||||
<div className="radio-group__column-horizontal-line"></div>
|
isFirst={index === 0}
|
||||||
|
isLast={index === options.length - 1}
|
||||||
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
color={checked ? COLORS.BLACK : COLORS.UI4}
|
color={checked ? COLORS.BLACK : COLORS.UI4}
|
||||||
fontWeight={FONT_WEIGHT.BOLD}
|
fontWeight={FONT_WEIGHT.BOLD}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user