File size: 954 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import React, { memo } from 'react'
import { ChartPropertyWithControl, Flavor } from '../../../types'
import { Control, Switch } from '../ui'
import { ControlContext, SwitchControlConfig } from '../types'
interface SwitchControlProps {
id: string
property: ChartPropertyWithControl<SwitchControlConfig>
flavors: Flavor[]
currentFlavor: Flavor
value: boolean
onChange: (value: boolean) => void
context?: ControlContext
}
export const SwitchControl = memo(
({ id, property, flavors, currentFlavor, value, onChange, context }: SwitchControlProps) => {
return (
<Control
id={id}
property={property}
flavors={flavors}
currentFlavor={currentFlavor}
context={context}
>
<Switch id={id} value={value} onChange={onChange} />
</Control>
)
}
)
|