Update SwitchComponent.tsx

This commit is contained in:
Hristo Nedelkov 2023-11-20 18:49:05 +02:00
parent f3dc2f9ca8
commit 5a56737809

View File

@ -1,24 +1,31 @@
import { Switch } from "tamagui"
import { Switch } from 'tamagui'
type SwitchComponentProps = {
timestamps: boolean
setTimestamps: (timestamps: boolean) => void
}
const SwitchComponent = () => {
const SwitchComponent = ({ timestamps, setTimestamps }: SwitchComponentProps) => {
const handleCheckedChange = () => {
setTimestamps(!timestamps)
}
return (
<Switch
size="$1"
style={ { backgroundColor: 'grey'} }
checked={false}
onCheckedChange={() =>(console.log(a))}
style={{ backgroundColor: timestamps ? '#4360df' : 'grey', border: 'none' }}
checked={timestamps}
onCheckedChange={handleCheckedChange}
>
<Switch.Thumb
style={{
right: 7,
bottom: 3,
backgroundColor: '#fff',
height: '16px',
width: '16px',
height: '18px',
width: '18px',
}}
/>
</Switch>
)
}
export default SwitchComponent
export default SwitchComponent