Skip to content

Commit

Permalink
feat(slider): support ui labels
Browse files Browse the repository at this point in the history
  • Loading branch information
lubber-de committed Oct 23, 2024
1 parent 28f0a4f commit 15d4e6b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/definitions/modules/slider.less
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@
top: auto;
bottom: 100%;
}
& when (@variationSliderUiLabel) {
.ui.labeled.slider.bottom.aligned .labels .ui.label {
margin-bottom: -@uiLabelMargin;
}
.ui.labeled.ticked.slider.bottom.aligned .labels .ui.label::after {
margin-bottom: @uiLabelMargin;
}
}
}
.ui.labeled.ticked.slider > .labels .halftick.label::after {
height: (@labelHeight / 2);
Expand All @@ -242,6 +250,17 @@
}
}
}
& when (@variationSliderUiLabel) {
.ui.labeled.slider:not(.vertical):not(.bottom) .labels .ui.label {
margin-top: -@uiLabelMargin;
}
.ui.labeled.ticked.slider:not(.vertical):not(.bottom) .labels .ui.label::after {
margin-top: @uiLabelMargin;
}
.ui.labeled.ticked.slider:not(.vertical) > .labels .ui.label::after {
height: @uiLabelTickHeight;
}
}

& when (@variationSliderVertical) {
/* Vertical Labels */
Expand Down Expand Up @@ -279,6 +298,11 @@
transform: translate(-100%, 50%);
}
}
& when (@variationSliderUiLabel) {
.ui.labeled.ticked.vertical.slider:not(.right) > .labels .ui.label::after {
margin-left: @verticalUiLabelMargin;
}
}
& when (@variationSliderRightAligned) {
.ui.labeled.vertical.right.aligned.slider > .labels {
transform: translateX(50%);
Expand All @@ -301,6 +325,11 @@
transform: translate(100%, 50%);
}
}
& when (@variationSliderUiLabel) {
.ui.labeled.ticked.vertical.right.aligned.slider > .labels .ui.label::after {
margin-right: @verticalUiLabelMargin;
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/themes/default/globals/variation.variables
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@
@variationSliderHighlight: true;
@variationSliderBottomAligned: true;
@variationSliderRightAligned: true;
@variationSliderUiLabel: true;
@variationSliderSizes: small, large, big;
@variationSliderColors: @variationAllColors;

Expand Down
3 changes: 3 additions & 0 deletions src/themes/default/modules/slider.variables
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@
/* Vertical */
@verticalPadding: 0.5em 1em;
@verticalTickDistance: 0.6em;
@verticalUiLabelMargin: 0.3em;

/* Labeled */
@labelHeight: @height;
@labelWidth: 1px;
@labelColor: @background;
@labelPadding: 0.2em 0;
@invertedLabelColor: @invertedBackground;
@uiLabelMargin: 0.5em;
@uiLabelTickHeight: 2em;

/* Hover */
@hoverVarOpacity: 0;
Expand Down

0 comments on commit 15d4e6b

Please sign in to comment.