Skip to content

Commit 170a07b

Browse files
authored
fix(label): adjusted basic labels height and attached image labels
basic labels have a border which increases the height in comparison to usual labels. When inline together the line height gets increased Because of that, a basic image label was not properly supported All attached labels were not really attached to the boundary of a segment (as every other attached component is doing) . That was especially visible when a basic attached label was used
1 parent 4ac35a7 commit 170a07b

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

src/definitions/elements/label.less

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,30 @@ a.ui.label {
168168
margin-bottom: @attachedSegmentPadding !important;
169169
}
170170

171+
.ui.segment:not(.basic) > .ui.top.attached.label {
172+
margin-top: @attachedOffset;
173+
}
174+
.ui.segment:not(.basic) > .ui.bottom.attached.label {
175+
margin-bottom: @attachedOffset;
176+
}
177+
.ui.segment:not(.basic) > .ui.attached.label:not(.right) {
178+
margin-left: @attachedOffset;
179+
}
180+
.ui.segment:not(.basic) > .ui.right.attached.label {
181+
margin-right: @attachedOffset;
182+
}
183+
.ui.segment:not(.basic) > .ui.attached.label:not(.left):not(.right) {
184+
width: @attachedWidthOffset;
185+
}
186+
187+
171188

172189
/*******************************
173190
Types
174191
*******************************/
175192
& when (@variationLabelImage) {
176193
.ui.image.label {
177-
width: auto !important;
194+
width: auto;
178195
margin-top: 0;
179196
margin-bottom: 0;
180197
max-width: 9999px;
@@ -185,6 +202,9 @@ a.ui.label {
185202
padding: @imageLabelPadding;
186203
border-radius: @imageLabelBorderRadius;
187204
box-shadow: @imageLabelBoxShadow;
205+
&.attached:not(.basic) when (@variationLabelAttached) {
206+
padding: @imageLabelPadding;
207+
}
188208
}
189209

190210
.ui.image.label img {
@@ -202,6 +222,17 @@ a.ui.label {
202222
padding: @imageLabelDetailPadding;
203223
border-radius: 0 @imageLabelBorderRadius @imageLabelBorderRadius 0;
204224
}
225+
& when (@variationLabelAttached) {
226+
.ui.bottom.attached.image.label:not(.right) > img,
227+
.ui.top.right.attached.image.label > img {
228+
border-top-left-radius: 0;
229+
}
230+
231+
.ui.top.attached.image.label:not(.right) > img,
232+
.ui.bottom.right.attached.image.label > img {
233+
border-bottom-left-radius: 0;
234+
}
235+
}
205236
}
206237

207238
& when (@variationLabelTag) {
@@ -483,7 +514,7 @@ a.ui.label {
483514

484515
.ui[class*="top left attached"].label {
485516
width: auto;
486-
margin-top: 0 !important;
517+
margin-top: 0;
487518
border-radius: @attachedCornerBorderRadius 0 @attachedBorderRadius 0;
488519
}
489520

@@ -610,6 +641,18 @@ a.ui.active.label:hover:before {
610641
border: @basicBorder;
611642
color: @basicColor;
612643
box-shadow: @basicBoxShadow;
644+
padding-top: @basicVerticalPadding;
645+
padding-bottom: @basicVerticalPadding;
646+
padding-right: @basicHorizontalPadding;
647+
}
648+
.ui.basic.labels:not(.tag):not(.image):not(.ribbon) .label,
649+
.ui.basic.label:not(.tag):not(.image):not(.ribbon) {
650+
padding-left: @basicHorizontalPadding;
651+
}
652+
& when (@variationLabelImage) {
653+
.ui.basic.image.label {
654+
padding-left: @basicImageLabelPadding;
655+
}
613656
}
614657

615658
/* Link */

src/themes/default/elements/label.variables

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@
116116
@basicHoverBorder: @basicBorder;
117117
@basicHoverBoxShadow: @basicBoxShadow;
118118

119+
@basicVerticalPadding: e(%("calc(%d - %d)", @verticalPadding, @basicBorderWidth));
120+
@basicHorizontalPadding: e(%("calc(%d - %d)", @horizontalPadding, @basicBorderWidth));
121+
@basicImageLabelPadding: e(%("calc(%d - %d)", @imageLabelTextDistance, @basicBorderWidth));
122+
119123
/* Tag */
120124
@tagCircleColor: @white;
121125
@tagCircleSize: 0.5em;
@@ -200,6 +204,9 @@
200204
@attachedCornerBorderRadius: @3px;
201205
@attachedBorderRadius: @borderRadius;
202206

207+
@attachedOffset: -@borderWidth;
208+
@attachedWidthOffset: e(%("calc(100%% + %d)", @borderWidth * 2));
209+
203210
/* Corner */
204211
@cornerSizeRatio: 1;
205212
@cornerTransition: color @labelTransitionDuration @labelTransitionEasing;

0 commit comments

Comments
 (0)