mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-06 19:09:52 -06:00
wiring up background color prop for switches
This commit is contained in:
@@ -67,7 +67,10 @@ export default function ServerAddress(): React.JSX.Element {
|
||||
onCheckedChange={(checked) => setUseHttps(checked)}
|
||||
label="Use HTTPS"
|
||||
size="$2"
|
||||
width={100} />
|
||||
width={100}
|
||||
backgroundColor="$accentColor"
|
||||
/>
|
||||
|
||||
|
||||
<Spacer />
|
||||
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
import { SizeTokens, XStack, Separator, Switch } from "tamagui";
|
||||
import { SizeTokens, XStack, Separator, Switch, ColorTokens } from "tamagui";
|
||||
import { Label } from "./text";
|
||||
|
||||
export function SwitchWithLabel(props: { size: SizeTokens; checked: boolean, label: string, onCheckedChange: (value: boolean) => void, width?: number }) {
|
||||
interface SwitchWithLabelProps {
|
||||
onCheckedChange: (value: boolean) => void,
|
||||
size: SizeTokens
|
||||
checked: boolean;
|
||||
label: string;
|
||||
width?: number | undefined;
|
||||
backgroundColor?: ColorTokens;
|
||||
}
|
||||
|
||||
export function SwitchWithLabel(props: SwitchWithLabelProps) {
|
||||
const id = `switch-${props.size.toString().slice(1)}-${props.checked ?? ''}}`
|
||||
return (
|
||||
<XStack alignItems="center" gap="$3">
|
||||
@@ -17,7 +26,7 @@ export function SwitchWithLabel(props: { size: SizeTokens; checked: boolean, lab
|
||||
size={props.size}
|
||||
checked={props.checked}
|
||||
onCheckedChange={(checked: boolean) => props.onCheckedChange(checked)}
|
||||
backgroundColor="$color"
|
||||
backgroundColor={props.backgroundColor}
|
||||
>
|
||||
<Switch.Thumb animation="quicker" />
|
||||
</Switch>
|
||||
|
||||
Reference in New Issue
Block a user