mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 11:23:50 +00:00
657cc22b44
* feat: parse cue * refactor: get delay from backend * feat: add cue to UI * refactor: remove deprecated delay logic * refactor: extract studio clock specific logic * refactor: extract utilities * refactor: fix issue with missing key * style: prevent cue overflow * style: prevent whitespace wrap * feat: add support for cues in integrations
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { useCallback } from 'react';
|
|
import { Textarea } from '@chakra-ui/react';
|
|
|
|
import useReactiveTextInput from '../../../common/components/input/text-input/useReactiveTextInput';
|
|
|
|
import { TitleActions } from './EventEditorDataLeft';
|
|
|
|
import style from '../EventEditor.module.scss';
|
|
|
|
interface CountedTextAreaProps {
|
|
field: TitleActions;
|
|
label: string;
|
|
initialValue: string;
|
|
submitHandler: (field: TitleActions, value: string) => void;
|
|
}
|
|
|
|
export default function CountedTextArea(props: CountedTextAreaProps) {
|
|
const { field, label, initialValue, submitHandler } = props;
|
|
|
|
const submitCallback = useCallback((newValue: string) => submitHandler(field, newValue), [field, submitHandler]);
|
|
|
|
const { value, onChange, onBlur, onKeyDown } = useReactiveTextInput(initialValue, submitCallback);
|
|
|
|
return (
|
|
<div className={`${style.column} ${style.fullHeight}`}>
|
|
<div className={style.countedInput}>
|
|
<label className={style.inputLabel} htmlFor={field}>
|
|
{label}
|
|
</label>
|
|
<span className={style.charCount}>{`${value.length} characters`}</span>
|
|
</div>
|
|
<Textarea
|
|
id={field}
|
|
size='sm'
|
|
resize='none'
|
|
variant='ontime-filled'
|
|
style={{ height: '100%' }}
|
|
data-testid='input-textarea'
|
|
value={value}
|
|
onChange={onChange}
|
|
onBlur={onBlur}
|
|
onKeyDown={onKeyDown}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|