Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 00b69b2

Browse files
danielkaxissteabert
authored andcommitted
fix(slider): align min and max tick labels
Tick labels aligned at minimum and maximum values are now aligned left and right of its container. Previously they were centered to its value which caused issues with long text.
1 parent d2b27b2 commit 00b69b2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

packages/core/src/Slider/Tick.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,25 @@ const BaseLabel = styled.div.attrs<{
6666
readonly center: number
6767
readonly width: number
6868
}>(({ center, width }) => ({
69-
style: { left: `calc(${center}% - ${width / 2}px)` },
70-
}))<{ readonly center: number; readonly width: number }>`
69+
style: (() => {
70+
if (center === 0) {
71+
return {
72+
left: 0,
73+
}
74+
}
75+
76+
if (center === 100) {
77+
return { right: 0 }
78+
}
79+
80+
return {
81+
left: `calc(${center}% - ${width / 2}px)`,
82+
}
83+
})(),
84+
}))<{
85+
readonly center: number
86+
readonly width: number
87+
}>`
7188
position: absolute;
7289
cursor: pointer;
7390

0 commit comments

Comments
 (0)