import * as React from 'react'; import { useState } from 'react' import { useTranslate } from '@portal/hooks'; import { LogEntry, LogEntryItem } from './LogEntry'; /** * A button that allows a single field to be submitted & logs displayed underneath. */ export interface TextLookupFormProps { /** * The big header above the button. */ title: string /** * Main description for what the button will do. Usually wrapped in

with 's inside. * All translation must be done before passing in the description. */ description: React.JSX.Element, /** * 2-3 words that appear on the button itself. */ buttonDescription: string /* * Triggered when users click the button to submit the form. * setLogEntries is internally used to display logs to the user as handleSubmit executes. * fieldValue represents the value they submitted with the form. */ handleSubmit: ( setLogEntries: React.Dispatch>, event: React.FormEvent, fieldValue: string) => void /** * Optionally include this as an example in the form to hint to users what they should type in. */ formPlaceholder?: string } /** * A form to look up a single text field and display logs to the user. * * @param props Text fields for the form / button and a handler when the button is clicked. * @returns A single-entry form which displays logs after submitting. */ export function TextLookupForm(props: TextLookupFormProps) { const { translate } = useTranslate() const { title, description, buttonDescription, formPlaceholder, handleSubmit } = props const [logEntries, setLogEntries] = useState([]) const [fieldValue, setFieldValue] = useState("") return (

handleSubmit(setLogEntries, event, fieldValue)}>

{translate(title)}

{description}
setFieldValue(event.target.value)} />


{logEntries?.length > 0 &&
{translate(`Result`)}
    {logEntries.map((log) => { return })}
}
) }