ToolJet/frontend/src/Editor/Components/TextArea.jsx

28 lines
792 B
React
Raw Normal View History

import React, { useEffect } from 'react';
2021-12-30 11:57:02 +00:00
export const TextArea = function TextArea({ height, properties, exposedVariables, styles, setExposedVariable }) {
2021-04-30 06:31:32 +00:00
useEffect(() => {
setExposedVariable('value', properties.value);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [properties.value]);
2021-04-14 11:32:03 +00:00
2021-04-30 06:31:32 +00:00
return (
<textarea
disabled={styles.disabledState}
2021-04-30 06:31:32 +00:00
onChange={(e) => {
setExposedVariable('value', e.target.value);
2021-04-30 06:31:32 +00:00
}}
type="text"
className="form-control textarea"
placeholder={properties.placeholder}
style={{
height,
resize: 'none',
display: styles.visibility ? '' : 'none',
borderRadius: `${styles.borderRadius}px`,
}}
value={exposedVariables.value}
2021-04-30 06:31:32 +00:00
></textarea>
);
2021-04-10 04:51:19 +00:00
};