|
| 1 | +// Ini untuk Widhi |
| 2 | +// Fungsi skrip ini untuk mengatur TAB baik ikon, teks maupun routing |
| 3 | +import React from 'react'; |
| 4 | +import { Redirect, Route } from 'react-router-dom'; |
| 5 | +import { |
| 6 | + IonApp, |
| 7 | + IonIcon, |
| 8 | + IonLabel, |
| 9 | + IonRouterOutlet, |
| 10 | + IonTabBar, |
| 11 | + IonTabButton, |
| 12 | + IonTabs |
| 13 | +} from '@ionic/react'; |
| 14 | + |
| 15 | +// Dibawah ini tugas mereka untuk memanggil fungsi / paket / skrip / file |
| 16 | +import { IonReactRouter } from '@ionic/react-router'; |
| 17 | +import { cloud, ellipse, information, informationCircle, searchCircle, searchOutline, square, triangle } from 'ionicons/icons'; |
| 18 | +import Tab1 from './pages/Tab1'; |
| 19 | +import Tab2 from './pages/Tab2'; |
| 20 | +import Tab3 from './pages/Tab3'; |
| 21 | + |
| 22 | +/* Core CSS required for Ionic components to work properly */ |
| 23 | +import '@ionic/react/css/core.css'; |
| 24 | + |
| 25 | +/* Basic CSS for apps built with Ionic */ |
| 26 | +import '@ionic/react/css/normalize.css'; |
| 27 | +import '@ionic/react/css/structure.css'; |
| 28 | +import '@ionic/react/css/typography.css'; |
| 29 | + |
| 30 | +/* Optional CSS utils that can be commented out */ |
| 31 | +import '@ionic/react/css/padding.css'; |
| 32 | +import '@ionic/react/css/float-elements.css'; |
| 33 | +import '@ionic/react/css/text-alignment.css'; |
| 34 | +import '@ionic/react/css/text-transformation.css'; |
| 35 | +import '@ionic/react/css/flex-utils.css'; |
| 36 | +import '@ionic/react/css/display.css'; |
| 37 | + |
| 38 | +/* Theme variables */ |
| 39 | +import './theme/variables.css'; |
| 40 | + |
| 41 | +// Mereka semua berfungsi untuk mengatur Tabs-tabs, baik ikon, judul, route kemana dll |
| 42 | + |
| 43 | +const App: React.FC = () => ( |
| 44 | + <IonApp> |
| 45 | + <IonReactRouter> |
| 46 | + <IonTabs> |
| 47 | + <IonRouterOutlet> |
| 48 | + <Route path="/tab1" component={Tab1} exact={true} /> |
| 49 | + <Route path="/tab2" component={Tab2} exact={true} /> |
| 50 | + <Route path="/tab3" component={Tab3} /> |
| 51 | + <Route path="/" render={() => <Redirect to="/tab1" />} exact={true} /> |
| 52 | + </IonRouterOutlet> |
| 53 | + <IonTabBar slot="bottom"> |
| 54 | + <IonTabButton tab="tab1" href="/tab1"> |
| 55 | + <IonIcon icon={cloud} /> |
| 56 | + <IonLabel>Cuaca</IonLabel> |
| 57 | + </IonTabButton> |
| 58 | + <IonTabButton tab="tab2" href="/tab2"> |
| 59 | + <IonIcon icon={searchOutline} /> |
| 60 | + <IonLabel>Prediksi</IonLabel> |
| 61 | + </IonTabButton> |
| 62 | + <IonTabButton tab="tab3" href="/tab3"> |
| 63 | + <IonIcon icon={informationCircle} /> |
| 64 | + <IonLabel>Tentang</IonLabel> |
| 65 | + </IonTabButton> |
| 66 | + </IonTabBar> |
| 67 | + </IonTabs> |
| 68 | + </IonReactRouter> |
| 69 | + </IonApp> |
| 70 | +); |
| 71 | + |
| 72 | +export default App; |
0 commit comments