'use client' import type { FC } from 'react' import Tooltip from '@/app/components/base/tooltip' import Slider from '@/app/components/base/slider' import Switch from '@/app/components/base/switch' type Props = { className?: string id: string name: string noTooltip?: boolean tip?: string value: number enable: boolean step?: number min?: number max: number onChange: (key: string, value: number) => void hasSwitch?: boolean onSwitchChange?: (key: string, enable: boolean) => void } const ParamItem: FC = ({ className, id, name, noTooltip, tip, step = 0.1, min = 0, max, value, enable, onChange, hasSwitch, onSwitchChange }) => { return (
{hasSwitch && ( { onSwitchChange?.(id, val) }} /> )} {name} {!noTooltip && ( {tip}
} /> )}
{ const value = parseFloat(e.target.value) if (value < min || value > max) return onChange(id, value) }} />
onChange(id, value / (max < 5 ? 100 : 1))} />
) } export default ParamItem