-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from atlp-rwanda/ch-setup-react-187584854
Deliver - [ch-setup-react-router-#187584858]
- Loading branch information
Showing
10 changed files
with
143 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
/* eslint-disable linebreak-style */ | ||
import React from 'react'; | ||
import LandingPage from './pages/LandingPage'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import AppRouter from './router'; | ||
|
||
const App: React.FC = () => ( | ||
<div> | ||
<LandingPage /> | ||
</div> | ||
<Router> | ||
<AppRouter /> | ||
</Router> | ||
); | ||
|
||
export default App; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable linebreak-style */ | ||
import React from 'react'; | ||
|
||
const getYear = (): number => new Date().getFullYear(); | ||
|
||
const Footer: React.FC = () => ( | ||
<footer> | ||
<p> | ||
© | ||
{getYear()} | ||
{' '} | ||
Ninja E-Commerce Store | ||
</p> | ||
</footer> | ||
); | ||
|
||
export default Footer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable linebreak-style */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
const Header: React.FC = () => ( | ||
<header> | ||
<nav> | ||
<ul> | ||
<li><Link to="/">Home</Link></li> | ||
<li><Link to="/login">Login</Link></li> | ||
</ul> | ||
</nav> | ||
</header> | ||
); | ||
|
||
export default Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
/* eslint-disable linebreak-style */ | ||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { Provider } from 'react-redux'; | ||
import { store } from './store/store'; | ||
import App from './App'; | ||
|
||
const root = createRoot(document.getElementById('root')!); | ||
root.render(<Provider store={store}><App /></Provider>); | ||
root.render( | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import Header from '../components/layout/Header'; | ||
|
||
const Login: React.FC = () => ( | ||
<> | ||
<Header /> | ||
<main> | ||
<h2>Login Page</h2> | ||
<p>Please login to continue.</p> | ||
</main> | ||
</> | ||
); | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
|
||
const NotFound: React.FC = () => ( | ||
<main> | ||
<h1> 404 -Not found </h1> | ||
<p> The page you are looking for does not exist. </p> | ||
</main> | ||
); | ||
|
||
export default NotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable linebreak-style */ | ||
/* eslint-disable arrow-body-style */ | ||
import React from 'react'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
import LandingPage from './pages/LandingPage'; | ||
import Login from './pages/Login'; | ||
import NotFound from './pages/NotFound'; | ||
|
||
const AppRouter: React.FC = () => { | ||
return ( | ||
<div> | ||
<Routes> | ||
<Route path="/" element={<LandingPage />} /> | ||
<Route path="/login" element={<Login />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AppRouter; |