|
1
|
import React from "react" |
|
2
|
import clsx from "clsx" |
|
3
|
import { Details } from "@/components/Details" |
|
4
|
import { MarkdownContent } from "@/components/MarkdownContent" |
|
5
|
|
|
6
|
type TroubleshootingSection = { |
|
7
|
title: string |
|
8
|
content: React.ReactNode |
|
9
|
} |
|
10
|
|
|
11
|
type DetailsListProps = { |
|
12
|
sections: TroubleshootingSection[] |
|
13
|
} & React.AllHTMLAttributes<HTMLDivElement> |
|
14
|
|
|
15
|
export const DetailsList = ({ sections }: DetailsListProps) => { |
|
16
|
return ( |
|
17
|
<> |
|
18
|
{sections.map(({ title, content }, index) => ( |
|
19
|
<Details |
|
20
|
summaryContent={title} |
|
21
|
key={index} |
|
22
|
className={clsx(index !== 0 && "border-t-0")} |
|
23
|
> |
|
24
|
{React.isValidElement(content) && content} |
|
25
|
{!React.isValidElement(content) && typeof content === "string" && ( |
|
26
|
<MarkdownContent>{content}</MarkdownContent> |
|
27
|
)} |
|
28
|
</Details> |
|
29
|
))} |
|
30
|
</> |
|
31
|
) |
|
32
|
} |