|
@@ -4,30 +4,24 @@ import {
|
4
|
4
|
IonItem,
|
5
|
5
|
IonLabel,
|
6
|
6
|
} from "@ionic/react";
|
7
|
|
-import ListComponent from "../components/ListComponent";
|
8
|
|
-import { Category } from "../types";
|
|
7
|
+import { PropsWithChildren } from "react";
|
9
|
8
|
import "./DropdownComponent.css";
|
10
|
9
|
|
11
|
|
-const DropdownComponent: React.FC<{
|
12
|
|
- category: Category[];
|
13
|
|
-}> = (props) => {
|
14
|
|
- const category = props.category;
|
|
10
|
+const DropdownComponent: React.FC<
|
|
11
|
+ {
|
|
12
|
+ name: string;
|
|
13
|
+ } & PropsWithChildren
|
|
14
|
+> = ({ name, children }) => {
|
15
|
15
|
return (
|
16
|
16
|
<IonAccordionGroup>
|
17
|
|
- {category.map((catItem: Category, index) => {
|
18
|
|
- return (
|
19
|
|
- <IonAccordion value={`${index}`}>
|
20
|
|
- <IonItem slot="header" color="light">
|
21
|
|
- <IonLabel>{catItem.name}</IonLabel>
|
22
|
|
- </IonItem>
|
23
|
|
- <IonItem slot="content">
|
24
|
|
- <div className="accordion-list-container">
|
25
|
|
- <ListComponent items={catItem.listItems} />
|
26
|
|
- </div>
|
27
|
|
- </IonItem>
|
28
|
|
- </IonAccordion>
|
29
|
|
- );
|
30
|
|
- })}
|
|
17
|
+ <IonAccordion value={name}>
|
|
18
|
+ <IonItem slot="header" color="light">
|
|
19
|
+ <IonLabel>{name}</IonLabel>
|
|
20
|
+ </IonItem>
|
|
21
|
+ <IonItem slot="content">
|
|
22
|
+ <div className="accordion-list-container">{children}</div>
|
|
23
|
+ </IonItem>
|
|
24
|
+ </IonAccordion>
|
31
|
25
|
</IonAccordionGroup>
|
32
|
26
|
);
|
33
|
27
|
};
|