import { IconButton, Input } from '@chakra-ui/react'; import { IoEye } from '@react-icons/all-files/io5/IoEye'; import { IoEyeOffOutline } from '@react-icons/all-files/io5/IoEyeOffOutline'; import TooltipActionBtn from '../../../common/components/buttons/TooltipActionBtn'; import { cx } from '../../../common/utils/styleUtils'; import { tooltipDelayMid } from '../../../ontimeConfig'; import style from './InputRow.module.scss'; interface InputRowProps { label: string; placeholder: string; text: string; visible?: boolean; readonly?: boolean; actionHandler: (action: string, payload: object) => void; changeHandler: (newValue: string) => void; className?: string; } export default function InputRow(props: InputRowProps) { const { label, placeholder, text, visible, actionHandler, changeHandler, className, readonly } = props; const handleInputChange = (newValue: string) => { changeHandler(newValue); }; const classes = cx([style.inputRow, className]); return (
handleInputChange(event.target.value)} placeholder={placeholder} /> {readonly ? ( : } aria-label={`Toggle ${label}`} variant={visible ? 'ontime-filled' : 'ontime-subtle'} /> ) : ( actionHandler('update', { field: 'isPublic', value: !visible })} tooltip={visible ? 'Make invisible' : 'Make visible'} aria-label={`Toggle ${label}`} openDelay={tooltipDelayMid} icon={visible ? : } variant={visible ? 'ontime-filled' : 'ontime-subtle'} size='sm' /> )}
); }