Browse Source

[mant] Merge all current conflicta

Sergio Mattei 1 year ago
parent
commit
b2e0660ba3

+ 14
- 20
src/components/DropdownComponent.tsx View File

@@ -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
 };

+ 9
- 3
src/components/TopicList.tsx View File

@@ -1,4 +1,10 @@
1
-import { IonContent, IonItem, IonLabel, IonListHeader } from "@ionic/react";
1
+import {
2
+  IonContent,
3
+  IonItem,
4
+  IonLabel,
5
+  IonList,
6
+  IonListHeader,
7
+} from "@ionic/react";
2 8
 import { Topic } from "../types";
3 9
 import SkeletonText from "./SkeletonText";
4 10
 import "../components/TopicList.css";
@@ -27,7 +33,7 @@ const TopicList: React.FC<{
27 33
   loading?: boolean;
28 34
 }> = ({ title, topics, loading }) => {
29 35
   return (
30
-    <IonContent>
36
+    <IonList>
31 37
       {title ? (
32 38
         <IonListHeader>
33 39
           <IonLabel>{title}</IonLabel>
@@ -47,7 +53,7 @@ const TopicList: React.FC<{
47 53
             </IonItem>
48 54
           );
49 55
         })}
50
-    </IonContent>
56
+    </IonList>
51 57
   );
52 58
 };
53 59
 export default TopicList;

+ 7
- 1
src/pages/AdviceListPage.tsx View File

@@ -8,6 +8,7 @@ import {
8 8
 } from "@ionic/react";
9 9
 import { alertCircleOutline } from "ionicons/icons";
10 10
 import useSWR from "swr";
11
+import DropdownComponent from "../components/DropdownComponent";
11 12
 import TopicList from "../components/TopicList";
12 13
 import { fetcher } from "../lib/api";
13 14
 import { Topic } from "../types";
@@ -32,7 +33,12 @@ const AdviceListPage: React.FC = () => {
32 33
             <IonTitle size="large">Advice</IonTitle>
33 34
           </IonToolbar>
34 35
         </IonHeader>
35
-        {data && <TopicList loading={isLoading} topics={data as Topic[]} />}
36
+        <DropdownComponent name="Parentesco">
37
+          <TopicList
38
+            loading={isLoading}
39
+            topics={data ? (data as Topic[]) : []}
40
+          />
41
+        </DropdownComponent>
36 42
         <IonToast
37 43
           icon={alertCircleOutline}
38 44
           color="danger"

+ 0
- 1
src/pages/ArticlePage.tsx View File

@@ -17,7 +17,6 @@ import { NotionRenderer } from "react-notion-x";
17 17
 import { fetcher } from "../lib/api";
18 18
 import useSWR from "swr";
19 19
 import { formatDate, getBlockTitle, getPageProperty } from "notion-utils";
20
-import omit from "lodash/omit";
21 20
 import SkeletonText from "../components/SkeletonText";
22 21
 
23 22
 const ArticlePage: React.FC<RouteComponentProps<{ articleId: string }>> = ({

+ 1
- 1
src/pages/LawListPage.tsx View File

@@ -33,7 +33,7 @@ const LawListPage: React.FC = () => {
33 33
             <IonTitle size="large">Leyes</IonTitle>
34 34
           </IonToolbar>
35 35
         </IonHeader>
36
-        {data && <TopicList loading={isLoading} topics={data as Topic[]} />}
36
+        <TopicList loading={isLoading} topics={data ? (data as Topic[]) : []} />
37 37
         <IonToast
38 38
           icon={alertCircleOutline}
39 39
           color="danger"