fix switch?

This commit is contained in:
Violet Caulfield
2025-02-20 06:41:27 -06:00
parent ad6d93dc0f
commit bb16ff6eaa

View File

@@ -1,4 +1,4 @@
import { SizeTokens, XStack, Separator, Switch, ColorTokens, Theme } from "tamagui";
import { SizeTokens, XStack, Separator, Switch, Theme, styled, getToken } from "tamagui";
import { Label } from "./text";
interface SwitchWithLabelProps {
@@ -7,9 +7,13 @@ interface SwitchWithLabelProps {
checked: boolean;
label: string;
width?: number | undefined;
backgroundColor?: ColorTokens;
}
const JellifySliderThumb = styled(Switch.Thumb, {
borderColor: getToken("$color.amethyst"),
backgroundColor: getToken("$color.purpleDark")
})
export function SwitchWithLabel(props: SwitchWithLabelProps) {
const id = `switch-${props.size.toString().slice(1)}-${props.checked ?? ''}}`
return (
@@ -29,7 +33,7 @@ export function SwitchWithLabel(props: SwitchWithLabelProps) {
checked={props.checked}
onCheckedChange={(checked: boolean) => props.onCheckedChange(checked)}
>
<Switch.Thumb animation="bouncy" />
<JellifySliderThumb animation="bouncy" />
</Switch>
</Theme>
</XStack>