Explorar el Código

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

Sergio Mattei hace 2 años
padre
commit
7a2b9e5176
Se han modificado 1 ficheros con 4 adiciones y 27 borrados
  1. 4
    27
      src/components/ListComponent.tsx

+ 4
- 27
src/components/ListComponent.tsx Ver fichero

@@ -1,10 +1,4 @@
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 2
 import "../components/ListComponent.css";
9 3
 
10 4
 const ListComponent: React.FC<{ title?: string; laws: string[] }> = (props) => {
@@ -18,30 +12,13 @@ const ListComponent: React.FC<{ title?: string; laws: string[] }> = (props) => {
18 12
         </IonListHeader>
19 13
       ) : null}
20 14
 
21
-      {laws.map((LawName: string) => {
15
+      {laws.map((lawName: string) => {
22 16
         return (
23
-          <IonItem href="#">
24
-            <p className="ListItemText">{LawName}</p>
17
+          <IonItem routerLink={`/article/${encodeURIComponent(lawName)}`}>
18
+            <p className="ListItemText">{lawName}</p>
25 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 22
     </IonContent>
46 23
   );
47 24
 };