Browse Source

[fix] Clean up code for ListComponent, add href -> ArticlePage

Sergio Mattei 2 years ago
parent
commit
7a2b9e5176
1 changed files with 4 additions and 27 deletions
  1. 4
    27
      src/components/ListComponent.tsx

+ 4
- 27
src/components/ListComponent.tsx View File

1
-import {
2
-  IonContent,
3
-  IonItem,
4
-  IonLabel,
5
-  IonList,
6
-  IonListHeader,
7
-} from "@ionic/react";
1
+import { IonContent, IonItem, IonLabel, IonListHeader } from "@ionic/react";
8
 import "../components/ListComponent.css";
2
 import "../components/ListComponent.css";
9
 
3
 
10
 const ListComponent: React.FC<{ title?: string; laws: string[] }> = (props) => {
4
 const ListComponent: React.FC<{ title?: string; laws: string[] }> = (props) => {
18
         </IonListHeader>
12
         </IonListHeader>
19
       ) : null}
13
       ) : null}
20
 
14
 
21
-      {laws.map((LawName: string) => {
15
+      {laws.map((lawName: string) => {
22
         return (
16
         return (
23
-          <IonItem href="#">
24
-            <p className="ListItemText">{LawName}</p>
17
+          <IonItem routerLink={`/article/${encodeURIComponent(lawName)}`}>
18
+            <p className="ListItemText">{lawName}</p>
25
           </IonItem>
19
           </IonItem>
26
         );
20
         );
27
       })}
21
       })}
28
-
29
-      {/*
30
-      <IonList className="list" lines="full">
31
-        <IonItem href="#">
32
-          <p className="ListItemText">Ley #1</p>
33
-        </IonItem>
34
-        <IonItem href="#">
35
-          <p className="ListItemText">Ley #1</p>
36
-        </IonItem>
37
-        <IonItem href="#">
38
-          <p className="ListItemText">Ley #1</p>
39
-        </IonItem>
40
-        <IonItem href="#">
41
-          <p className="ListItemText">Ley #1</p>
42
-        </IonItem>
43
-      </IonList>
44
-      */}
45
     </IonContent>
22
     </IonContent>
46
   );
23
   );
47
 };
24
 };