Skip to content

Commit b80cc8c

Browse files
samejrclaude
andcommitted
feat(webapp): add a surround-free switch variant and move it to indigo
Adds minimal/medium: the same toggle as medium without the padded hover box, for rows that don't need the enlarged hit area. medium keeps it. The unchecked track still lightens on hover, so the control keeps an affordance without the surround. The checked fill moves from blue-500 to indigo-500, matching the primary accent the buttons and checkboxes use. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 77ed110 commit b80cc8c

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

apps/webapp/app/components/primitives/Switch.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ const variations = {
5252
thumb: "size-3.5 data-[state=checked]:translate-x-3.5 data-[state=unchecked]:translate-x-0",
5353
text: "text-sm text-text-dimmed",
5454
},
55+
/* Like medium, minus the hover box: the toggle is the whole target, for rows
56+
that already carry their own affordance. */
57+
"minimal/medium": {
58+
container: "flex items-center gap-x-2 rounded-md focus-custom",
59+
root: "h-4 w-8",
60+
thumb: "size-3.5 data-[state=checked]:translate-x-3.5 data-[state=unchecked]:translate-x-0",
61+
text: "text-sm text-text-dimmed",
62+
},
5563
};
5664

5765
type SwitchProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {
@@ -91,7 +99,7 @@ export const Switch = React.forwardRef<React.ElementRef<typeof SwitchPrimitives.
9199
const switchElement = (
92100
<div
93101
className={cn(
94-
"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors group-disabled:cursor-not-allowed group-disabled:opacity-50 group-data-[state=checked]:bg-blue-500 group-data-[state=unchecked]:bg-background-raised group-hover:group-data-[state=unchecked]:bg-surface-control-active/50",
102+
"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors group-disabled:cursor-not-allowed group-disabled:opacity-50 group-data-[state=checked]:bg-indigo-500 group-data-[state=unchecked]:bg-background-raised group-hover:group-data-[state=unchecked]:bg-surface-control-active/50",
95103
root
96104
)}
97105
>

apps/webapp/app/routes/account._index/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ export default function Page() {
593593
</div>
594594
<div className="flex flex-none items-center">
595595
<Switch
596-
variant="medium"
596+
variant="minimal/medium"
597597
aria-label="Icon contrast"
598598
checked={iconContrast}
599599
onCheckedChange={(checked) =>

0 commit comments

Comments
 (0)