Browse Source

[mant] Merge all current conflicta

Sergio Mattei 2 years ago
parent
commit
b2e0660ba3

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

4
   IonItem,
4
   IonItem,
5
   IonLabel,
5
   IonLabel,
6
 } from "@ionic/react";
6
 } from "@ionic/react";
7
-import ListComponent from "../components/ListComponent";
8
-import { Category } from "../types";
7
+import { PropsWithChildren } from "react";
9
 import "./DropdownComponent.css";
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
   return (
15
   return (
16
     <IonAccordionGroup>
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
     </IonAccordionGroup>
25
     </IonAccordionGroup>
32
   );
26
   );
33
 };
27
 };

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

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

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

8
 } from "@ionic/react";
8
 } from "@ionic/react";
9
 import { alertCircleOutline } from "ionicons/icons";
9
 import { alertCircleOutline } from "ionicons/icons";
10
 import useSWR from "swr";
10
 import useSWR from "swr";
11
+import DropdownComponent from "../components/DropdownComponent";
11
 import TopicList from "../components/TopicList";
12
 import TopicList from "../components/TopicList";
12
 import { fetcher } from "../lib/api";
13
 import { fetcher } from "../lib/api";
13
 import { Topic } from "../types";
14
 import { Topic } from "../types";
32
             <IonTitle size="large">Advice</IonTitle>
33
             <IonTitle size="large">Advice</IonTitle>
33
           </IonToolbar>
34
           </IonToolbar>
34
         </IonHeader>
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
         <IonToast
42
         <IonToast
37
           icon={alertCircleOutline}
43
           icon={alertCircleOutline}
38
           color="danger"
44
           color="danger"

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

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

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

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