Files
ontime/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TextLikeInput.tsx
T
Carlos Valente 836fa52757 fix: small style tweaks and bug fixes
fix: remove interactive styles from display elements

fix: automation form reset on submit

fix: prevent empty image src
2025-08-18 06:16:53 +02:00

46 lines
1.1 KiB
TypeScript

import { forwardRef, HTMLAttributes, memo, PropsWithChildren, useImperativeHandle, useRef } from 'react';
import { cx } from '../../../../common/utils/styleUtils';
import style from './TextLikeInput.module.scss';
interface TextLikeInputProps extends HTMLAttributes<HTMLSpanElement> {
offset?: 'over' | 'under' | 'muted' | null;
muted?: boolean;
disabled?: boolean;
}
const TextLikeInput = forwardRef(
(
{ offset, muted, disabled, children, className, ...elementProps }: PropsWithChildren<TextLikeInputProps>,
textRef,
) => {
const ref = useRef<HTMLDivElement | null>(null);
const classes = cx([
style.textInput,
offset && style[offset],
muted && style.muted,
disabled && style.disabled,
className,
]);
useImperativeHandle(textRef, () => {
return {
focusParentElement() {
ref.current?.parentElement?.focus();
},
};
});
return (
<div className={classes} tabIndex={disabled ? -1 : 0} {...elementProps} ref={ref}>
{children}
</div>
);
},
);
TextLikeInput.displayName = 'TextLikeInput';
export default memo(TextLikeInput);