Przeglądaj źródła

Merge branch 'matteing-sprint-1' of sergio.mattei/RenacerSocial into main

eliam.ruiz 2 lat temu
rodzic
commit
e1edfc39e3

+ 21
- 19
src/App.tsx Wyświetl plik

@@ -10,10 +10,8 @@ import {
10 10
   setupIonicReact,
11 11
 } from "@ionic/react";
12 12
 import { IonReactRouter } from "@ionic/react-router";
13
-import { ellipse, square, triangle } from "ionicons/icons";
14
-import Tab1 from "./pages/Tab1";
15
-import Tab2 from "./pages/home";
16
-import Tab3 from "./pages/Tab3";
13
+import { ellipse, home } from "ionicons/icons";
14
+import Home from "./pages/Home";
17 15
 
18 16
 /* Core CSS required for Ionic components to work properly */
19 17
 import "@ionic/react/css/core.css";
@@ -33,6 +31,9 @@ import "@ionic/react/css/display.css";
33 31
 
34 32
 /* Theme variables */
35 33
 import "./theme/variables.css";
34
+import AdviceListPage from "./pages/AdviceListPage";
35
+import LawListPage from "./pages/LawListPage";
36
+import ArticlePage from "./pages/ArticlePage";
36 37
 
37 38
 setupIonicReact();
38 39
 
@@ -41,31 +42,32 @@ const App: React.FC = () => (
41 42
     <IonReactRouter>
42 43
       <IonTabs>
43 44
         <IonRouterOutlet>
44
-          <Route exact path="/tab1">
45
-            <Tab1 />
45
+          <Route exact path="/home">
46
+            <Home />
46 47
           </Route>
47
-          <Route exact path="/tab2">
48
-            <Tab2 />
48
+          <Route path="/advice">
49
+            <AdviceListPage />
49 50
           </Route>
50
-          <Route path="/tab3">
51
-            <Tab3 />
51
+          <Route path="/laws">
52
+            <LawListPage />
52 53
           </Route>
54
+          <Route path="/article/:slug" component={ArticlePage} />
53 55
           <Route exact path="/">
54
-            <Redirect to="/tab1" />
56
+            <Redirect to="/home" />
55 57
           </Route>
56 58
         </IonRouterOutlet>
57 59
         <IonTabBar slot="bottom">
58
-          <IonTabButton tab="tab1" href="/tab1">
59
-            <IonIcon icon={triangle} />
60
-            <IonLabel>Tab 1</IonLabel>
60
+          <IonTabButton tab="home" href="/home">
61
+            <IonIcon icon={home} />
62
+            <IonLabel>Home</IonLabel>
61 63
           </IonTabButton>
62
-          <IonTabButton tab="tab2" href="/tab2">
64
+          <IonTabButton tab="advice" href="/advice">
63 65
             <IonIcon icon={ellipse} />
64
-            <IonLabel>Tab 2</IonLabel>
66
+            <IonLabel>Advice</IonLabel>
65 67
           </IonTabButton>
66
-          <IonTabButton tab="tab3" href="/tab3">
67
-            <IonIcon icon={square} />
68
-            <IonLabel>Tab 3</IonLabel>
68
+          <IonTabButton tab="laws" href="/laws">
69
+            <IonIcon icon={ellipse} />
70
+            <IonLabel>Laws</IonLabel>
69 71
           </IonTabButton>
70 72
         </IonTabBar>
71 73
       </IonTabs>

+ 4
- 27
src/components/ListComponent.tsx Wyświetl plik

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

+ 30
- 0
src/pages/AdviceListPage.tsx Wyświetl plik

@@ -0,0 +1,30 @@
1
+import {
2
+  IonContent,
3
+  IonHeader,
4
+  IonPage,
5
+  IonTitle,
6
+  IonToolbar,
7
+} from "@ionic/react";
8
+import ListComponent from "../components/ListComponent";
9
+
10
+const AdviceListPage: React.FC = () => {
11
+  return (
12
+    <IonPage>
13
+      <IonHeader>
14
+        <IonToolbar>
15
+          <IonTitle>Consejos</IonTitle>
16
+        </IonToolbar>
17
+      </IonHeader>
18
+      <IonContent fullscreen>
19
+        <IonHeader collapse="condense">
20
+          <IonToolbar>
21
+            <IonTitle size="large">Consejos</IonTitle>
22
+          </IonToolbar>
23
+        </IonHeader>
24
+        <ListComponent laws={["Consejo 1", "Consejo 2"]} />
25
+      </IonContent>
26
+    </IonPage>
27
+  );
28
+};
29
+
30
+export default AdviceListPage;

+ 51
- 0
src/pages/ArticlePage.tsx Wyświetl plik

@@ -0,0 +1,51 @@
1
+import {
2
+  IonBackButton,
3
+  IonButtons,
4
+  IonCard,
5
+  IonCardContent,
6
+  IonCardHeader,
7
+  IonCardSubtitle,
8
+  IonCardTitle,
9
+  IonContent,
10
+  IonHeader,
11
+  IonPage,
12
+  IonTitle,
13
+  IonToolbar,
14
+} from "@ionic/react";
15
+import { RouteComponentProps } from "react-router";
16
+
17
+const ArticlePage: React.FC<RouteComponentProps<{ slug: string }>> = ({
18
+  match,
19
+}) => {
20
+  return (
21
+    <IonPage>
22
+      <IonHeader>
23
+        <IonToolbar>
24
+          <IonButtons slot="start">
25
+            <IonBackButton />
26
+          </IonButtons>
27
+          <IonTitle>{match.params.slug}</IonTitle>
28
+        </IonToolbar>
29
+      </IonHeader>
30
+      <IonContent fullscreen>
31
+        <IonCard>
32
+          <img
33
+            alt="Silhouette of mountains"
34
+            src="https://ionicframework.com/docs/img/demos/card-media.png"
35
+          />
36
+          <IonCardHeader>
37
+            <IonCardTitle>{match.params.slug}</IonCardTitle>
38
+            <IonCardSubtitle>Card Subtitle</IonCardSubtitle>
39
+          </IonCardHeader>
40
+
41
+          <IonCardContent>
42
+            Here's a small text description for the card content. Nothing more,
43
+            nothing less.
44
+          </IonCardContent>
45
+        </IonCard>
46
+      </IonContent>
47
+    </IonPage>
48
+  );
49
+};
50
+
51
+export default ArticlePage;

src/pages/home.tsx → src/pages/Home.tsx Wyświetl plik

@@ -5,12 +5,10 @@ import {
5 5
   IonTitle,
6 6
   IonToolbar,
7 7
 } from "@ionic/react";
8
-import ExploreContainer from "../components/ExploreContainer";
9
-import "./home.css";
10 8
 import "../components/ListComponent";
11 9
 import ListComponent from "../components/ListComponent";
12 10
 
13
-const Tab2: React.FC = () => {
11
+const Home: React.FC = () => {
14 12
   return (
15 13
     <IonPage>
16 14
       <IonHeader>
@@ -32,10 +30,13 @@ const Tab2: React.FC = () => {
32 30
           </p>
33 31
         </div>
34 32
 
35
-        <ListComponent laws={["eliam", "Sergio"]} title="Articulos Recientes" />
33
+        <ListComponent
34
+          laws={["Articulo 1", "Articulo 2"]}
35
+          title="Articulos Recientes"
36
+        />
36 37
       </IonContent>
37 38
     </IonPage>
38 39
   );
39 40
 };
40 41
 
41
-export default Tab2;
42
+export default Home;

+ 30
- 0
src/pages/LawListPage.tsx Wyświetl plik

@@ -0,0 +1,30 @@
1
+import {
2
+  IonContent,
3
+  IonHeader,
4
+  IonPage,
5
+  IonTitle,
6
+  IonToolbar,
7
+} from "@ionic/react";
8
+import ListComponent from "../components/ListComponent";
9
+
10
+const LawListPage: React.FC = () => {
11
+  return (
12
+    <IonPage>
13
+      <IonHeader>
14
+        <IonToolbar>
15
+          <IonTitle>Leyes</IonTitle>
16
+        </IonToolbar>
17
+      </IonHeader>
18
+      <IonContent fullscreen>
19
+        <IonHeader collapse="condense">
20
+          <IonToolbar>
21
+            <IonTitle size="large">Leyes</IonTitle>
22
+          </IonToolbar>
23
+        </IonHeader>
24
+        <ListComponent laws={["Law 1", "Law 2"]} />
25
+      </IonContent>
26
+    </IonPage>
27
+  );
28
+};
29
+
30
+export default LawListPage;

+ 0
- 0
src/pages/Tab1.css Wyświetl plik


+ 0
- 26
src/pages/Tab1.tsx Wyświetl plik

@@ -1,26 +0,0 @@
1
-import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/react';
2
-import './Tab1.css';
3
-import '../components/ListComponent'
4
-import ListComponent from '../components/ListComponent';
5
-
6
-const Tab1: React.FC = () => {
7
-  return (
8
-    <IonPage>
9
-      <IonHeader>
10
-        <IonToolbar>
11
-          <IonTitle>List component test!</IonTitle>
12
-        </IonToolbar>
13
-      </IonHeader>
14
-      <IonContent fullscreen>
15
-        <IonHeader collapse="condense">
16
-          <IonToolbar>
17
-            <IonTitle size="large">This is a list</IonTitle>
18
-          </IonToolbar>
19
-        </IonHeader>
20
-       <ListComponent laws={[]}/>
21
-      </IonContent>
22
-    </IonPage>
23
-  );
24
-};
25
-
26
-export default Tab1;

+ 0
- 0
src/pages/Tab3.css Wyświetl plik


+ 0
- 25
src/pages/Tab3.tsx Wyświetl plik

@@ -1,25 +0,0 @@
1
-import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/react';
2
-import ExploreContainer from '../components/ExploreContainer';
3
-import './Tab3.css';
4
-
5
-const Tab3: React.FC = () => {
6
-  return (
7
-    <IonPage>
8
-      <IonHeader>
9
-        <IonToolbar>
10
-          <IonTitle>Tab 3</IonTitle>
11
-        </IonToolbar>
12
-      </IonHeader>
13
-      <IonContent fullscreen>
14
-        <IonHeader collapse="condense">
15
-          <IonToolbar>
16
-            <IonTitle size="large">Tab 3</IonTitle>
17
-          </IonToolbar>
18
-        </IonHeader>
19
-        <ExploreContainer name="Tab 3 page" />
20
-      </IonContent>
21
-    </IonPage>
22
-  );
23
-};
24
-
25
-export default Tab3;

+ 0
- 0
src/pages/home.css Wyświetl plik