Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/toggle-switch-knob-styling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Fix `ToggleSwitch` knob spacing and border-radius to match `primer/react`
16 changes: 10 additions & 6 deletions app/components/primer/alpha/toggle_switch.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
& .ToggleSwitch-knob {
background-color: var(--controlKnob-bgColor-checked);
border-color: var(--controlKnob-borderColor-checked);
transform: translateX(100%);
transform: translateX(calc(100% - 2px));
Comment thread
dylanatsmith marked this conversation as resolved.
Outdated
}

& .ToggleSwitch-lineIcon {
Expand All @@ -113,7 +113,6 @@

& .ToggleSwitch-knob {
border-color: var(--borderColor-default);
box-shadow: none;
}

& .ToggleSwitch-lineIcon {
Expand Down Expand Up @@ -155,14 +154,19 @@

.ToggleSwitch-knob {
position: absolute;
top: 0;
bottom: 0;
/* stylelint-disable-next-line primer/spacing */
top: 1px;
/* stylelint-disable-next-line primer/spacing */
bottom: 1px;
/* stylelint-disable-next-line primer/spacing */
left: 1px;
Comment thread
dylanatsmith marked this conversation as resolved.
Outdated
z-index: 1;
width: 50%;
background-color: var(--controlKnob-bgColor-rest);
border: var(--borderWidth-thin) solid var(--controlKnob-borderColor-rest);
border-radius: var(--borderRadius-medium);
box-shadow: var(--shadow-resting-medium), var(--button-default-shadow-inset);
/* Use calc to account for the 1px border around the track */
/* stylelint-disable-next-line primer/borders */
border-radius: calc(var(--borderRadius-medium) - var(--borderWidth-thick));
Comment thread
dylanatsmith marked this conversation as resolved.
Outdated
transition-timing-function: cubic-bezier(0.5, 1, 0.89, 1);
transition-duration: 80ms;
transition-property: transform;
Expand Down
Loading