Skip to content

Commit

Permalink
remove DisplayData
Browse files Browse the repository at this point in the history
  • Loading branch information
allenchuang committed Dec 9, 2023
1 parent 7ae7a97 commit 9b96d53
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions app/admin/AccordionInputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,6 @@ function getDefaultValuesFromSchema(
return values;
}

function DisplayData({ data }: { data: any }) {
if (typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') {
return <p>{data.toString()}</p>;
}
if (Array.isArray(data)) {
return (
<div>
{data.map((item, index) => (
<DisplayData key={index} data={item} />
))}
</div>
);
}

if (typeof data === 'object' && data !== null) {
return (
<div>
{Object.keys(data).map((key) => (
<div key={key}>
<strong>{key}:</strong>
<DisplayData data={data[key]} />
</div>
))}
</div>
);
}

return null; // fallback for unsupported data types
}

type NestedFieldProps = {
control: any;
name: string;
Expand Down

0 comments on commit 9b96d53

Please sign in to comment.