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

27 lines
740 B
React
Raw Normal View History

import React, { useEffect } from 'react';
export const TextArea = function TextArea({ width, 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"
placeholder={properties.placeholder}
style={{
height,
resize: 'none',
display: styles.visibility ? '' : 'none',
}}
value={exposedVariables.value}
2021-04-30 06:31:32 +00:00
></textarea>
);
2021-04-10 04:51:19 +00:00
};