1
+ import { IonContent , IonHeader , IonIcon , IonLabel , IonPage , IonRouterOutlet , IonTabBar , IonTabButton , IonTabs , IonTitle , IonToolbar } from '@ionic/react' ;
2
+ import { homeOutline , radioOutline , libraryOutline , searchOutline } from 'ionicons/icons' ;
3
+ import React from 'react' ;
4
+ import { Route , Redirect } from 'react-router-dom' ;
5
+
6
+ const HomePage : React . FC = ( ) => (
7
+ < IonPage >
8
+ < IonHeader >
9
+ < IonToolbar >
10
+ < IonTitle > Home</ IonTitle >
11
+ </ IonToolbar >
12
+ </ IonHeader >
13
+ < IonContent >
14
+ < div data-testid = "home-content" > Home Content</ div >
15
+ </ IonContent >
16
+ </ IonPage >
17
+ ) ;
18
+
19
+ const RadioPage : React . FC = ( ) => (
20
+ < IonPage >
21
+ < IonHeader >
22
+ < IonToolbar >
23
+ < IonTitle > Radio</ IonTitle >
24
+ </ IonToolbar >
25
+ </ IonHeader >
26
+ < IonContent >
27
+ < div data-testid = "radio-content" > Radio Content</ div >
28
+ </ IonContent >
29
+ </ IonPage >
30
+ ) ;
31
+
32
+ const LibraryPage : React . FC = ( ) => (
33
+ < IonPage >
34
+ < IonHeader >
35
+ < IonToolbar >
36
+ < IonTitle > Library</ IonTitle >
37
+ </ IonToolbar >
38
+ </ IonHeader >
39
+ < IonContent >
40
+ < div data-testid = "library-content" > Library Content</ div >
41
+ </ IonContent >
42
+ </ IonPage >
43
+ ) ;
44
+
45
+ const SearchPage : React . FC = ( ) => (
46
+ < IonPage >
47
+ < IonHeader >
48
+ < IonToolbar >
49
+ < IonTitle > Search</ IonTitle >
50
+ </ IonToolbar >
51
+ </ IonHeader >
52
+ < IonContent >
53
+ < div data-testid = "search-content" > Search Content</ div >
54
+ </ IonContent >
55
+ </ IonPage >
56
+ ) ;
57
+
58
+ const TabsDirectNavigation : React . FC = ( ) => {
59
+ return (
60
+ < IonTabs data-testid = "tabs-direct-navigation" >
61
+ < IonRouterOutlet >
62
+ < Redirect exact path = "/tabs-direct-navigation" to = "/tabs-direct-navigation/home" />
63
+ < Route path = "/tabs-direct-navigation/home" render = { ( ) => < HomePage /> } exact = { true } />
64
+ < Route path = "/tabs-direct-navigation/radio" render = { ( ) => < RadioPage /> } exact = { true } />
65
+ < Route path = "/tabs-direct-navigation/library" render = { ( ) => < LibraryPage /> } exact = { true } />
66
+ < Route path = "/tabs-direct-navigation/search" render = { ( ) => < SearchPage /> } exact = { true } />
67
+ </ IonRouterOutlet >
68
+
69
+ < IonTabBar slot = "bottom" data-testid = "tab-bar" >
70
+ < IonTabButton tab = "home" href = "/tabs-direct-navigation/home" data-testid = "home-tab" >
71
+ < IonIcon icon = { homeOutline } > </ IonIcon >
72
+ < IonLabel > Home</ IonLabel >
73
+ </ IonTabButton >
74
+
75
+ < IonTabButton tab = "radio" href = "/tabs-direct-navigation/radio" data-testid = "radio-tab" >
76
+ < IonIcon icon = { radioOutline } > </ IonIcon >
77
+ < IonLabel > Radio</ IonLabel >
78
+ </ IonTabButton >
79
+
80
+ < IonTabButton tab = "library" href = "/tabs-direct-navigation/library" data-testid = "library-tab" >
81
+ < IonIcon icon = { libraryOutline } > </ IonIcon >
82
+ < IonLabel > Library</ IonLabel >
83
+ </ IonTabButton >
84
+
85
+ < IonTabButton tab = "search" href = "/tabs-direct-navigation/search" data-testid = "search-tab" >
86
+ < IonIcon icon = { searchOutline } > </ IonIcon >
87
+ < IonLabel > Search</ IonLabel >
88
+ </ IonTabButton >
89
+ </ IonTabBar >
90
+ </ IonTabs >
91
+ ) ;
92
+ } ;
93
+
94
+ export default TabsDirectNavigation ;
0 commit comments