Skip to content

Commit

Permalink
feat: add side menu
Browse files Browse the repository at this point in the history
  • Loading branch information
akmalhisyammm committed Nov 14, 2021
1 parent 254512a commit cee32ea
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 10 deletions.
22 changes: 13 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IonApp, IonRouterOutlet } from '@ionic/react';
import { IonApp, IonRouterOutlet, IonSplitPane } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
import { Route } from 'react-router-dom';

Expand All @@ -9,6 +9,7 @@ import About from 'pages/About';
import EditProfile from 'pages/main/profile/EditProfile';

import MainTabs from 'components/MainTabs';
import SideMenu from 'components/SideMenu';

/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
Expand All @@ -33,14 +34,17 @@ import 'theme/customTheme.css';
const App: React.FC = () => (
<IonApp>
<IonReactRouter>
<IonRouterOutlet>
<Route exact path="/" component={Landing} />
<Route path="/login" component={Login} />
<Route path="/register" component={Register} />
<Route path="/about" component={About} />
<Route path="/edit-profile" component={EditProfile} />
<Route path="/main" component={MainTabs} />
</IonRouterOutlet>
<IonSplitPane contentId="main">
<SideMenu />
<IonRouterOutlet id="main">
<Route exact path="/" component={Landing} />
<Route path="/login" component={Login} />
<Route path="/register" component={Register} />
<Route path="/about" component={About} />
<Route path="/edit-profile" component={EditProfile} />
<Route path="/main" component={MainTabs} />
</IonRouterOutlet>
</IonSplitPane>
</IonReactRouter>
</IonApp>
);
Expand Down
41 changes: 41 additions & 0 deletions src/components/SideMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
IonMenu,
IonHeader,
IonToolbar,
IonTitle,
IonContent,
IonList,
IonMenuToggle,
IonItem,
IonIcon,
IonLabel,
} from '@ionic/react';
import { informationCircle } from 'ionicons/icons';

const SideMenu: React.FC = () => {
return (
<IonMenu contentId="main">
<IonHeader>
<IonToolbar color="secondary">
<IonTitle>KlikDarurat</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
<IonList>
<IonMenuToggle autoHide={false}>
<IonItem button routerLink="/about">
<IonIcon
slot="start"
color="secondary"
icon={informationCircle}
/>
<IonLabel>Tentang</IonLabel>
</IonItem>
</IonMenuToggle>
</IonList>
</IonContent>
</IonMenu>
);
};

export default SideMenu;
4 changes: 3 additions & 1 deletion src/theme/customTheme.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:root {
ion-app {
--ion-font-family: 'Poppins', sans-serif;
max-width: 1200px;
margin: 0 auto;
}

0 comments on commit cee32ea

Please sign in to comment.