Skip to content

Commit beb2746

Browse files
Merge pull request #310 from softnetics/supakorn/fix/components
fix: switch layout bug.
2 parents aeb7240 + c16bc95 commit beb2746

3 files changed

Lines changed: 7 additions & 48 deletions

File tree

.changeset/fair-cats-tease.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@example/ui-playground": patch
3+
"@genseki/ui": patch
4+
---
5+
6+
fix: switch layout bug.

examples/ui-playground/src/app/playground/shadcn/switch-section.tsx

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -172,44 +172,6 @@ function DisabledSwitch() {
172172
)
173173
}
174174

175-
// Switch Sizes
176-
function SwitchSizes() {
177-
const [small, setSmall] = React.useState(false)
178-
const [defaultSize, setDefaultSize] = React.useState(true)
179-
const [large, setLarge] = React.useState(false)
180-
181-
return (
182-
<div className="space-y-6">
183-
<div className="space-y-4">
184-
<div className="flex items-center justify-between">
185-
<Label htmlFor="small-switch">Small Switch</Label>
186-
<Switch
187-
id="small-switch"
188-
checked={small}
189-
onCheckedChange={setSmall}
190-
className="h-4 w-8"
191-
/>
192-
</div>
193-
194-
<div className="flex items-center justify-between">
195-
<Label htmlFor="default-switch">Default Switch</Label>
196-
<Switch id="default-switch" checked={defaultSize} onCheckedChange={setDefaultSize} />
197-
</div>
198-
199-
<div className="flex items-center justify-between">
200-
<Label htmlFor="large-switch">Large Switch</Label>
201-
<Switch
202-
id="large-switch"
203-
checked={large}
204-
onCheckedChange={setLarge}
205-
className="h-8 w-16"
206-
/>
207-
</div>
208-
</div>
209-
</div>
210-
)
211-
}
212-
213175
// Switch with Form
214176
function SwitchWithForm() {
215177
const [formData, setFormData] = React.useState({
@@ -412,15 +374,6 @@ export function SwitchSection() {
412374
</div>
413375
</PlaygroundCard>
414376

415-
<PlaygroundCard title="Switch Sizes" categoryTitle="Component">
416-
<Typography type="body" className="text-muted-foreground mb-4">
417-
Switches in different sizes: small, default, and large.
418-
</Typography>
419-
<div className="p-4 bg-secondary w-full rounded-lg">
420-
<SwitchSizes />
421-
</div>
422-
</PlaygroundCard>
423-
424377
<PlaygroundCard title="Switch with Form" categoryTitle="Component">
425378
<Typography type="body" className="text-muted-foreground mb-4">
426379
Switches integrated into a form with multiple options and state management.

packages/ui/src/components/primitives/switch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimi
1111
<SwitchPrimitive.Root
1212
data-slot="switch"
1313
className={cn(
14-
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-16 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50',
14+
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring dark:data-[state=unchecked]:bg-input/80 inline-flex h-fit w-16 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50',
1515
className
1616
)}
1717
{...props}

0 commit comments

Comments
 (0)