/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React, { useState, useEffect } from 'react'; import { FormField, Textarea, SpaceBetween } from '@awsui/components-react'; const MultiValueStringAttribute = ({attribute, value, isReadonly, errorText, handleUserInput, displayHelpInfoLink}) => { const [localValue, setLocalValue] = useState(value); const [currentErrorText, setCurrentErrorText] = useState(errorText); function handleUpdate(event){ setLocalValue(event.detail.value); handleUserInput({field: attribute.name, value: event.detail.value === '' ? [] : event.detail.value.split('\n'), validationError: currentErrorText}) } useEffect(() => { setCurrentErrorText(errorText); }, [errorText]); return ( {attribute.description}{displayHelpInfoLink(attribute)} :{attribute.name}{displayHelpInfoLink(attribute)} } description={attribute.long_desc} errorText={currentErrorText} >