Refactor _option-input to allow independent borders

This commit is contained in:
rubenmoya 2017-11-21 09:42:54 +01:00
parent 6862ba81b3
commit d81979530d

View File

@ -99,67 +99,90 @@
*/ */
.CDB-OptionInput { .CDB-OptionInput {
width: 100%;
height: $baseSize * 4;
border: 1px solid $cMainLine;
border-radius: $baseSize / 2;
box-sizing: border-box; box-sizing: border-box;
width: 100%;
height: $baseSize * 4 - 2px;
border-radius: $baseSize / 2;
vertical-align: middle; vertical-align: middle;
}
&:hover { .CDB-OptionInput-container {
border: 1px solid $cHoverLine; display: flex;
align-content: center;
align-items: center;
&--noMargin {
margin: 0;
} }
}
.CDB-OptionInput-item {
display: flex;
position: relative;
box-sizing: content-box;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
font-size: $sFontSize-medium;
&.is-active,
&:hover,
&:focus {
cursor: pointer;
}
&:first-child {
width: auto;
margin-right: $baseSize;
}
&:last-child {
width: 100%;
}
}
.CDB-OptionInput-container:not(.CDB-OptionInput-container--noBorder) .CDB-OptionInput-item {
padding: 0 $baseSize;
border: 1px solid $cMainLine;
&.is-active,
&:hover,
&:focus { &:focus {
border: 1px solid $cBlue; border: 1px solid $cBlue;
} }
}
.CDB-OptionInput.is-active {
border: 1px solid $cBlue;
}
.CDB-OptionInput-container {
@include display-flex();
@include align-content(center);
@include align-items(center);
margin: 0 $baseSize;
}
.CDB-OptionInput-container--noMargin {
margin: 0;
}
.CDB-OptionInput-item {
@include display-flex();
@include align-items(center);
@include align-content(center);
width: auto;
height: 100%;
font-size: $sFontSize-medium;
box-sizing: content-box;
&::after { &:first-child {
margin-right: 0;
border-radius: 4px 0 0 4px;
}
&:last-child {
border-radius: 4px;
}
+ .CDB-OptionInput-item {
border-left: none;
border-radius: 0 4px 4px 0;
&:hover::after {
content: '';
position: absolute;
left: 0;
width: 1px; width: 1px;
height: 100%; height: 100%;
margin-right: $baseSize; background-color: $cBlue;
background-color: $cSecondaryLine;
content: '';
} }
&:last-child { }
width: 100%; }
&::after {
display: none;
}
}
}
.CDB-OptionInput-item--noSeparator::after {
content: '';
}
.CDB-OptionInput-content { .CDB-OptionInput-content {
@include display-flex(); display: flex;
@include align-items(center);
height: 100%;
margin-left: -$baseSize;
padding: 0 $baseSize + 2;
color: $cMainBg;
box-sizing: content-box; box-sizing: content-box;
align-items: center;
justify-content: center;
height: 100%;
color: $cMainBg;
white-space: nowrap; white-space: nowrap;
&:hover { &:hover {