dify/web/app/components/workflow/panel/chat-variable-panel/components/bool-value.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

41 lines
896 B
TypeScript

'use client'
import type { FC } from 'react'
import * as React from 'react'
import { useCallback } from 'react'
import OptionCard from '../../../nodes/_base/components/option-card'
type Props = Readonly<{
value: boolean
onChange: (value: boolean) => void
}>
const BoolValue: FC<Props> = ({ value, onChange }) => {
const booleanValue = value
const handleChange = useCallback(
(newValue: boolean) => {
return () => {
onChange(newValue)
}
},
[onChange],
)
return (
<div className="flex w-full space-x-1">
<OptionCard
className="grow"
selected={booleanValue}
title="True"
onSelect={handleChange(true)}
/>
<OptionCard
className="grow"
selected={!booleanValue}
title="False"
onSelect={handleChange(false)}
/>
</div>
)
}
export default React.memo(BoolValue)