|
@@ -0,0 +1,45 @@
|
|
1
|
+import {
|
|
2
|
+ IonAccordion,
|
|
3
|
+ IonAccordionGroup,
|
|
4
|
+ IonItem,
|
|
5
|
+ IonLabel,
|
|
6
|
+} from "@ionic/react";
|
|
7
|
+import "../components/ListComponent";
|
|
8
|
+import ListComponent from "../components/ListComponent";
|
|
9
|
+import "../intefaces";
|
|
10
|
+import Category from "../intefaces";
|
|
11
|
+
|
|
12
|
+const DropdownComponent: React.FC<{
|
|
13
|
+ category: Category[];
|
|
14
|
+}> = (props) => {
|
|
15
|
+ const category = props.category;
|
|
16
|
+ return (
|
|
17
|
+ <IonAccordionGroup>
|
|
18
|
+ {category.map((catItem: Category, index) => {
|
|
19
|
+ var position = "";
|
|
20
|
+ if (index === 1) {
|
|
21
|
+ position = "first";
|
|
22
|
+ } else if (index === 2) {
|
|
23
|
+ position = "second";
|
|
24
|
+ } else if (index === 3) {
|
|
25
|
+ position = "third";
|
|
26
|
+ } else if (index === 4) {
|
|
27
|
+ position = "fourth";
|
|
28
|
+ } else if (index === 5) {
|
|
29
|
+ position = "fifth";
|
|
30
|
+ }
|
|
31
|
+ return (
|
|
32
|
+ <IonAccordion value={position}>
|
|
33
|
+ <IonItem slot="header" color="light">
|
|
34
|
+ <IonLabel>{catItem.name}</IonLabel>
|
|
35
|
+ </IonItem>
|
|
36
|
+ <IonItem slot="content">
|
|
37
|
+ <ListComponent items={catItem.listItems} />
|
|
38
|
+ </IonItem>
|
|
39
|
+ </IonAccordion>
|
|
40
|
+ );
|
|
41
|
+ })}
|
|
42
|
+ </IonAccordionGroup>
|
|
43
|
+ );
|
|
44
|
+};
|
|
45
|
+export default DropdownComponent;
|