refactor: Improve TextOutputView component
This commit refactors the TextOutputView component to handle a specific case where the `value` prop is an object with a `text` property. It updates the component to check if the `value` is an object and if it contains the `text` property. If so, it assigns the value of `value.text` to `value`. This change improves the flexibility and usability of the component.
This commit is contained in:
parent
d4a3e83e80
commit
68f5b38bd2
1 changed files with 10 additions and 7 deletions
|
|
@ -1,14 +1,17 @@
|
|||
import { Textarea } from "../../../components/ui/textarea";
|
||||
|
||||
const TextOutputView = ({ left, value }) => {
|
||||
if (typeof value === "object" && Object.keys(value).includes("text")) {
|
||||
value = value.text;
|
||||
}
|
||||
return (
|
||||
<Textarea
|
||||
className={`w-full custom-scroll ${left ? "min-h-32" : "h-full"}`}
|
||||
placeholder={"Empty"}
|
||||
// update to real value on flowPool
|
||||
value={value}
|
||||
readOnly
|
||||
/>
|
||||
<Textarea
|
||||
className={`w-full custom-scroll ${left ? "min-h-32" : "h-full"}`}
|
||||
placeholder={"Empty"}
|
||||
// update to real value on flowPool
|
||||
value={value}
|
||||
readOnly
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue