Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy adding animation an ui #34

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"firebase": "^9.6.1",
"framer-motion": "^5.6.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.3.1",
Expand Down
48 changes: 26 additions & 22 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AnimatePresence } from "framer-motion";
import React, { useContext } from "react";
import { Routes, Route, Link } from "react-router-dom";
import { Routes, Route, Link, useLocation } from "react-router-dom";
import useAuthListner from "./hooks/useAuthListner";
import useUser from "./hooks/useUser";
import Feedback from "./pages/Feedback";
Expand All @@ -9,6 +10,8 @@ import RequireAuth from "./utils/requireAuth.route";

const App = () => {
const { user } = useAuthListner();
const location = useLocation();

return (
<>
<nav>
Expand All @@ -17,27 +20,28 @@ const App = () => {
</Link>
</nav>
<div className="navMargin"></div>
{console.log(user)}
<Routes>
{/* <ProtectedRoute path="/" user={user} element={<Home />} /> */}
<Route
path="/"
element={
<RequireAuth user={user} redirectTo="/login">
<Home />
</RequireAuth>
}
/>
<Route
path="/feedback"
element={
<RequireAuth user={user} redirectTo="/login">
<Feedback />
</RequireAuth>
}
/>
<Route path="/login" element={<Login />} />
</Routes>
<AnimatePresence exitBeforeEnter>
<Routes location={location} key={location.pathname}>
{/* <ProtectedRoute path="/" user={user} element={<Home />} /> */}
<Route
path="/"
element={
<RequireAuth user={user} redirectTo="/login">
<Home />
</RequireAuth>
}
/>
<Route
path="/feedback"
element={
<RequireAuth user={user} redirectTo="/login">
<Feedback />
</RequireAuth>
}
/>
<Route path="/login" element={<Login />} />
</Routes>
</AnimatePresence>
</>
);
};
Expand Down
Loading