2
2
import { Portal , Box , useDisclosure } from "@chakra-ui/react" ;
3
3
import Footer from "components/footer/FooterAdmin.js" ;
4
4
// Layout components
5
- import Navbar from "components/navbar/NavbarAdmin .js" ;
5
+ import Navbar from "components/navbar/NavbarRTL .js" ;
6
6
import Sidebar from "components/sidebar/Sidebar.js" ;
7
7
import { SidebarContext } from "contexts/SidebarContext" ;
8
+ import { RtlProvider } from "components/rtlProvider/RtlProvider.js" ;
8
9
import React , { useState } from "react" ;
9
10
import { Redirect , Route , Switch } from "react-router-dom" ;
10
11
import routes from "routes.js" ;
@@ -17,7 +18,7 @@ export default function Dashboard(props) {
17
18
const [ toggleSidebar , setToggleSidebar ] = useState ( false ) ;
18
19
// functions for changing the states from components
19
20
const getRoute = ( ) => {
20
- return window . location . pathname !== "/admin /full-screen-maps" ;
21
+ return window . location . pathname !== "/rtl /full-screen-maps" ;
21
22
} ;
22
23
const getActiveRoute = ( routes ) => {
23
24
let activeRoute = "Default Brand Text" ;
@@ -109,61 +110,66 @@ export default function Dashboard(props) {
109
110
}
110
111
} ) ;
111
112
} ;
112
- document . documentElement . dir = "ltr " ;
113
+ document . documentElement . dir = "rtl " ;
113
114
const { onOpen } = useDisclosure ( ) ;
114
115
return (
115
- < Box >
116
- < SidebarContext . Provider
117
- value = { {
118
- toggleSidebar,
119
- setToggleSidebar,
120
- } } >
121
- < Sidebar routes = { routes } display = 'none' { ...rest } />
122
- < Box
123
- float = 'right'
124
- minHeight = '100vh'
125
- height = '100%'
126
- overflow = 'auto'
127
- position = 'relative'
128
- maxHeight = '100%'
129
- w = { { base : "100%" , xl : "calc( 100% - 290px )" } }
130
- maxWidth = { { base : "100%" , xl : "calc( 100% - 290px )" } }
131
- transition = 'all 0.33s cubic-bezier(0.685, 0.0473, 0.346, 1)'
132
- transitionDuration = '.2s, .2s, .35s'
133
- transitionProperty = 'top, bottom, width'
134
- transitionTimingFunction = 'linear, linear, ease' >
135
- < Portal >
136
- < Box >
137
- < Navbar
138
- onOpen = { onOpen }
139
- logoText = { "Horizon UI Dashboard PRO" }
140
- brandText = { getActiveRoute ( routes ) }
141
- secondary = { getActiveNavbar ( routes ) }
142
- message = { getActiveNavbarText ( routes ) }
143
- fixed = { fixed }
144
- { ...rest }
145
- />
146
- </ Box >
147
- </ Portal >
116
+ < RtlProvider >
117
+ < Box >
118
+ < SidebarContext . Provider
119
+ value = { {
120
+ toggleSidebar,
121
+ setToggleSidebar,
122
+ } }
123
+ >
124
+ < Sidebar routes = { routes } display = "none" { ...rest } />
125
+ < Box
126
+ float = "left"
127
+ minHeight = "100vh"
128
+ height = "100%"
129
+ overflow = "auto"
130
+ position = "relative"
131
+ maxHeight = "100%"
132
+ w = { { base : "100%" , xl : "calc( 100% - 290px )" } }
133
+ maxWidth = { { base : "100%" , xl : "calc( 100% - 290px )" } }
134
+ transition = "all 0.33s cubic-bezier(0.685, 0.0473, 0.346, 1)"
135
+ transitionDuration = ".2s, .2s, .35s"
136
+ transitionProperty = "top, bottom, width"
137
+ transitionTimingFunction = "linear, linear, ease"
138
+ >
139
+ < Portal >
140
+ < Box >
141
+ < Navbar
142
+ onOpen = { onOpen }
143
+ logoText = { "Horizon UI Dashboard PRO" }
144
+ brandText = { getActiveRoute ( routes ) }
145
+ secondary = { getActiveNavbar ( routes ) }
146
+ message = { getActiveNavbarText ( routes ) }
147
+ fixed = { fixed }
148
+ { ...rest }
149
+ />
150
+ </ Box >
151
+ </ Portal >
148
152
149
- { getRoute ( ) ? (
150
- < Box
151
- mx = 'auto'
152
- p = { { base : "20px" , md : "30px" } }
153
- pe = '20px'
154
- minH = '100vh'
155
- pt = '50px' >
156
- < Switch >
157
- { getRoutes ( routes ) }
158
- < Redirect from = '/' to = '/admin/default' />
159
- </ Switch >
153
+ { getRoute ( ) ? (
154
+ < Box
155
+ mx = "auto"
156
+ p = { { base : "20px" , md : "30px" } }
157
+ pe = "20px"
158
+ minH = "100vh"
159
+ pt = "50px"
160
+ >
161
+ < Switch >
162
+ { getRoutes ( routes ) }
163
+ < Redirect from = "/" to = "/rtl/rtl-default" />
164
+ </ Switch >
165
+ </ Box >
166
+ ) : null }
167
+ < Box >
168
+ < Footer />
160
169
</ Box >
161
- ) : null }
162
- < Box >
163
- < Footer />
164
170
</ Box >
165
- </ Box >
166
- </ SidebarContext . Provider >
167
- </ Box >
171
+ </ SidebarContext . Provider >
172
+ </ Box >
173
+ </ RtlProvider >
168
174
) ;
169
175
}
0 commit comments