import { Box } from '@mui/material'; import React, { useState } from 'react'; import ToolContent from '@components/ToolContent'; import { ToolComponentProps } from '@tools/defineTool'; import ToolTextInput from '@components/input/ToolTextInput'; import ToolTextResult from '@components/result/ToolTextResult'; import { CardExampleType } from '@components/examples/ToolExamples'; import { validateXml } from './service'; import { InitialValuesType } from './types'; const initialValues: InitialValuesType = {}; const exampleCards: CardExampleType[] = [ { title: 'Validate XML', description: 'Check if an XML string is well-formed.', sampleText: '12', sampleResult: 'Valid XML', sampleOptions: {} }, { title: 'Invalid XML', description: 'Example of malformed XML.', sampleText: '12', sampleResult: 'Invalid XML: ...', sampleOptions: {} } ]; export default function XmlValidator({ title, longDescription }: ToolComponentProps) { const [input, setInput] = useState(''); const [result, setResult] = useState(''); const compute = (_values: InitialValuesType, input: string) => { setResult(validateXml(input, {})); }; return ( } resultComponent={} initialValues={initialValues} exampleCards={exampleCards} getGroups={null} setInput={setInput} compute={compute} toolInfo={{ title: `What is a ${title}?`, description: longDescription }} /> ); }