You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { connect } from "react-redux";
import Navbar from "./components/Navbar";
import BG from "./components/BG";
import _ from "lodash";
3 years ago
import Home from "./views/Home";
import Products from "./views/Products";
import Product from "./views/Product";
// import VideoTube from "./views/Home/VideoTube";
function Router({ isDark }) {
return (
<div className={_.join([isDark ? "dark" : ""], " ")}>
<div
className={_.join(
[
"min-h-screen min-w-screen rtl overflow-x-hidden py-20 lg:py-0",
isDark ? "" : "bg-white",
],
" "
)}
>
<BrowserRouter>
<Navbar />
<BG />
<Routes>
<Route path="/" exact element={<Home />} />
<Route path="/products" exact element={<Products />} />
<Route path="/products/:id" exact element={<Product />} />
<Route
path="*"
element={
<main>
<h1>No matches routes.</h1>
</main>
}
/>
</Routes>
</BrowserRouter>
</div>
</div>
);
}
const mapStateToProps = (state) => ({
isDark: state.publicApi.isDark,
});
export default connect(mapStateToProps, {})(Router);