Skip to content

Commit 60a1f20

Browse files
committed
Working on nav
1 parent a2fa883 commit 60a1f20

File tree

4 files changed

+48
-40
lines changed

4 files changed

+48
-40
lines changed

components/AppShell.jsx

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Feed from './pages/Feed';
99
import Lists from './pages/Lists';
1010
import ListDetail from './pages/ListDetail';
1111
import Settings from './pages/Settings';
12+
import Tabs from './pages/Tabs';
1213

1314
setupIonicReact({});
1415

@@ -24,37 +25,10 @@ const AppShell = () => {
2425
return (
2526
<IonApp>
2627
<IonReactRouter>
27-
<IonTabs>
28-
<IonRouterOutlet>
29-
<Route path="/tabs/feed" exact={true}>
30-
<Feed />
31-
</Route>
32-
<Route path="/tabs/lists" exact={true}>
33-
<Lists />
34-
</Route>
35-
<Route path="/tabs/lists/:listId" exact={true}>
36-
<ListDetail />
37-
</Route>
38-
<Route path="/tabs/settings" exact={true}>
39-
<Settings />
40-
</Route>
41-
<Route path="/" render={() => <Redirect to="/tabs/feed" />} exact={true} />
42-
</IonRouterOutlet>
43-
<IonTabBar slot="bottom">
44-
<IonTabButton tab="tab1" href="/tabs/feed">
45-
<IonIcon icon={flash} />
46-
<IonLabel>Feed</IonLabel>
47-
</IonTabButton>
48-
<IonTabButton tab="tab2" href="/tabs/lists">
49-
<IonIcon icon={list} />
50-
<IonLabel>Lists</IonLabel>
51-
</IonTabButton>
52-
<IonTabButton tab="tab3" href="/tabs/settings">
53-
<IonIcon icon={cog} />
54-
<IonLabel>Settings</IonLabel>
55-
</IonTabButton>
56-
</IonTabBar>
57-
</IonTabs>
28+
<IonRouterOutlet id="main">
29+
<Route path="/tabs" render={() => <Tabs />} />
30+
<Route path="/" render={() => <Redirect to="/tabs/feed" />} exact={true} />
31+
</IonRouterOutlet>
5832
</IonReactRouter>
5933
</IonApp>
6034
);

components/pages/ListDetail.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,15 @@ const ListDetail = ({ match }) => {
4242

4343
return (
4444
<IonPage>
45-
<IonHeader translucent>
45+
<IonHeader>
4646
<IonToolbar>
4747
<IonButtons slot="start">
4848
<IonBackButton defaultHref="/tabs/lists" />
4949
</IonButtons>
5050
<IonTitle>{loadedList.name}</IonTitle>
5151
</IonToolbar>
5252
</IonHeader>
53-
<IonContent fullscreen>
54-
<IonHeader collapse="condense">
55-
<IonToolbar>
56-
<IonTitle size="large">{loadedList.name}</IonTitle>
57-
</IonToolbar>
58-
</IonHeader>
53+
<IonContent>
5954
<ListItems list={loadedList} />
6055
</IonContent>
6156
</IonPage>

components/pages/Lists.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ const AllLists = ({ onSelect }) => {
3333
const Lists = () => {
3434
return (
3535
<IonPage>
36-
<IonHeader>
36+
<IonHeader translucent={true}>
3737
<IonToolbar>
3838
<IonTitle>Lists</IonTitle>
3939
</IonToolbar>
4040
</IonHeader>
41-
<IonContent fullscreen>
41+
<IonContent fullscreen={true}>
4242
<IonHeader collapse="condense">
4343
<IonToolbar>
4444
<IonTitle size="large">Lists</IonTitle>

components/pages/Tabs.jsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Redirect, Route } from 'react-router-dom';
2+
import { IonRouterOutlet, IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/react';
3+
import { IonReactRouter } from '@ionic/react-router';
4+
import { cog, flash, list } from 'ionicons/icons';
5+
6+
import Home from './Feed';
7+
import Lists from './Lists';
8+
import ListDetail from './ListDetail';
9+
import Settings from './Settings';
10+
11+
const Tabs = () => {
12+
return (
13+
<IonTabs>
14+
<IonRouterOutlet>
15+
<Route path="/tabs/feed" render={() => <Home />} exact={true} />
16+
<Route path="/tabs/lists" render={() => <Lists />} exact={true} />
17+
<Route path="/tabs/lists/:listId" render={() => <ListDetail />} exact={true} />
18+
<Route path="/tabs/settings" render={() => <Settings />} exact={true} />
19+
<Route path="/tabs" render={() => <Redirect to="/tabs/feed" />} exact={true} />
20+
</IonRouterOutlet>
21+
<IonTabBar slot="bottom">
22+
<IonTabButton tab="tab1" href="/tabs/feed">
23+
<IonIcon icon={flash} />
24+
<IonLabel>Feed</IonLabel>
25+
</IonTabButton>
26+
<IonTabButton tab="tab2" href="/tabs/lists">
27+
<IonIcon icon={list} />
28+
<IonLabel>Lists</IonLabel>
29+
</IonTabButton>
30+
<IonTabButton tab="tab3" href="/tabs/settings">
31+
<IonIcon icon={cog} />
32+
<IonLabel>Settings</IonLabel>
33+
</IonTabButton>
34+
</IonTabBar>
35+
</IonTabs>
36+
);
37+
};
38+
39+
export default Tabs;

0 commit comments

Comments
 (0)