Skip to content

Commit

Permalink
add routes, actions and reducers for local auth
Browse files Browse the repository at this point in the history
  • Loading branch information
heytulsiprasad committed Sep 7, 2020
1 parent a5fafc2 commit bd9c2d4
Show file tree
Hide file tree
Showing 46 changed files with 882 additions and 91,465 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# css
src/tailwind.generated.css
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@fullhuman/postcss-purgecss": "^2.3.0",
"autoprefixer": "^9.8.6",
"axios": "^0.20.0",
"npm-run-all": "^4.1.5",
"postcss-cli": "^7.1.2",
"lodash": "^4.17.20",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"tailwindcss": "^1.7.6"
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"styled-components": "^5.2.0"
},
"scripts": {
"build:tailwind": "postcss src/tailwind.css -o src/tailwind.generated.css",
"watch:tailwind": "postcss -w src/tailwind.css -o src/tailwind.generated.css",
"start": "react-scripts start",
"dev": "run-p watch:tailwind start",
"prebuild": "npm run build:tailwind",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
Expand All @@ -41,5 +37,6 @@
},
"devDependencies": {
"chokidar-cli": "^2.1.0"
}
},
"proxy": "http://localhost:5000"
}
20 changes: 0 additions & 20 deletions postcss.config.js

This file was deleted.

28 changes: 17 additions & 11 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import React from "react";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import { Provider } from "react-redux";

import "./App.css";
import "./tailwind.generated.css";
import SignupContainer from "./components/SignupContainer/SingupContainer";
import LoginContainer from "./components/LoginContainer/LoginContainer";
import SignupContainer from "./containers/SignupContainer";
import LoginContainer from "./containers/LoginContainer";
import PrivateRoute from "./containers/PrivateRoute";
import Dashboard from "./containers/Dashboard";
import store from "./redux/store";

function App() {
return (
<React.Fragment>
<Router>
<Switch>
<Route path="/signup" component={SignupContainer} />
<Route path="/login" component={LoginContainer} />
</Switch>
</Router>
</React.Fragment>
<Provider store={store}>
<React.Fragment>
<Router>
<Switch>
<Route exact path="/signup" component={SignupContainer} />
<Route exact path="/login" component={LoginContainer} />
<PrivateRoute exact path="/dashboard" component={Dashboard} />
</Switch>
</Router>
</React.Fragment>
</Provider>
);
}

Expand Down
52 changes: 26 additions & 26 deletions src/assets/svg/Facebook.jsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import React from "react";

function Icon() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="43"
height="43"
fill="none"
viewBox="0 0 43 43"
>
<circle cx="21.809" cy="21.598" r="20.5" stroke="#828282"></circle>
<g clip-path="url(#clip0)">
<path
fill="#828282"
d="M28.796 13.442H16.07c-1.454 0-2.637 1.154-2.637 2.572V28.43c0 1.419 1.183 2.573 2.637 2.573h5.308v-6.208h-2.11v-3.087h2.11v-2.092c0-1.703 1.42-3.087 3.164-3.087h3.2v3.087h-3.2v2.092h3.2l-.528 3.087h-2.672v6.208h4.254c1.454 0 2.637-1.154 2.637-2.573V16.014c0-1.418-1.183-2.572-2.637-2.572z"
></path>
</g>
<defs>
<clipPath id="clip0">
<path
fill="#fff"
d="M0 0H18V17.561H0z"
transform="translate(13.433 13.442)"
></path>
</clipPath>
</defs>
</svg>
);
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="43"
height="43"
fill="none"
viewBox="0 0 43 43"
>
<circle cx="21.809" cy="21.598" r="20.5" stroke="#828282"></circle>
<g clipPath="url(#clip0)">
<path
fill="#828282"
d="M28.796 13.442H16.07c-1.454 0-2.637 1.154-2.637 2.572V28.43c0 1.419 1.183 2.573 2.637 2.573h5.308v-6.208h-2.11v-3.087h2.11v-2.092c0-1.703 1.42-3.087 3.164-3.087h3.2v3.087h-3.2v2.092h3.2l-.528 3.087h-2.672v6.208h4.254c1.454 0 2.637-1.154 2.637-2.573V16.014c0-1.418-1.183-2.572-2.637-2.572z"
></path>
</g>
<defs>
<clipPath id="clip0">
<path
fill="#fff"
d="M0 0H18V17.561H0z"
transform="translate(13.433 13.442)"
></path>
</clipPath>
</defs>
</svg>
);
}

export default Icon;
2 changes: 1 addition & 1 deletion src/assets/svg/GitHub.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Icon() {
viewBox="0 0 43 43"
>
<circle cx="21.661" cy="21.598" r="20.5" stroke="#828282"></circle>
<g clip-path="url(#clip0)">
<g clipPath="url(#clip0)">
<path
fill="#828282"
d="M22.285 13.442c-4.943 0-9 4.057-9 9 0 4.218 2.96 8.05 6.891 9v-2.978a2.2 2.2 0 01-1.144-.029c-.532-.157-.964-.511-1.285-1.051-.205-.345-.567-.72-.945-.692l-.093-1.05c.818-.07 1.525.498 1.945 1.203.186.314.401.498.677.579.266.078.552.04.885-.077.083-.667.389-.917.62-1.268-2.344-.35-3.279-1.594-3.65-2.576-.49-1.303-.227-2.931.642-3.96.017-.02.047-.073.035-.11-.398-1.203.088-2.199.105-2.304.46.136.535-.137 1.997.752l.253.151c.106.064.073.028.179.02a7.636 7.636 0 011.888-.266c.64.008 1.28.1 1.915.272l.082.009c-.007-.002.022-.006.072-.035 1.827-1.107 1.761-.745 2.251-.904.018.105.497 1.117.103 2.305-.053.164 1.584 1.663.676 4.07-.37.982-1.305 2.226-3.649 2.575.3.459.662.702.66 1.647v3.717c3.93-.95 6.89-4.782 6.89-9 0-4.943-4.056-9-9-9z"
Expand Down
2 changes: 1 addition & 1 deletion src/assets/svg/Twitter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Icon() {
viewBox="0 0 43 43"
>
<circle cx="21.735" cy="21.598" r="20.5" stroke="#828282"></circle>
<g clip-path="url(#clip0)">
<g clipPath="url(#clip0)">
<path
fill="#828282"
d="M19.45 29.826c-.778 0-1.58-.063-2.385-.19-1.42-.222-2.857-.965-3.263-1.187l-1.067-.583 1.155-.38c1.262-.415 2.03-.672 2.98-1.076-.952-.46-1.685-1.29-2.038-2.361l-.269-.816.22.034a4.006 4.006 0 01-.501-.619c-.455-.69-.696-1.534-.644-2.257l.05-.712.426.165c-.18-.34-.31-.702-.386-1.082a4.118 4.118 0 01.439-2.772l.371-.682.497.597c1.57 1.886 3.558 3.005 5.919 3.332a3.54 3.54 0 01.215-1.88 3.522 3.522 0 011.431-1.642 4.3 4.3 0 012.496-.613 3.985 3.985 0 012.45 1.01c.329-.085.57-.176.897-.299.197-.074.42-.158.699-.254l1.028-.354-.67 1.915.137-.01 1.098-.049-.649.887-.06.085c-.052.08-.117.177-1.008 1.367a1.678 1.678 0 00-.314 1.092c.08 1.546-.11 2.945-.564 4.157a7.356 7.356 0 01-1.974 2.925c-1.09.982-2.482 1.655-4.134 1.998-.81.17-1.68.254-2.582.254z"
Expand Down
39 changes: 39 additions & 0 deletions src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";
import styled from "styled-components";

const ButtonParent = styled.div`
margin: 20px 0 30px;
button {
background: #2f80ed;
border-radius: 8px;
border: none;
outline: none;
text-align: center;
color: #fff;
font-weight: 500;
padding: 10px 20px;
width: 100%;
cursor: pointer;
}
button:hover {
transition: opacity 0.1s ease-in;
opacity: 0.9;
}
button:active {
transition: transform 0.1s ease-in;
transform: scale(0.99);
}
`;

const Button = ({ children, clickHandler }) => {
return (
<ButtonParent>
<button onClick={clickHandler}>{children}</button>
</ButtonParent>
);
};

export default Button;
13 changes: 0 additions & 13 deletions src/components/Button/Button.jsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/components/Button/Button.module.css

This file was deleted.

28 changes: 28 additions & 0 deletions src/components/CenterBox.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import styled from "styled-components";

const CenterBoxParent = styled.div`
/* Positioning */
grid-row: 2 / 3;
grid-column: 4 / 5;
height: fit-content;
align-self: center;
/* Box decorations */
border: 1px solid #bdbdbd;
border-radius: 1.5rem;
/* Spacing */
padding: 3rem;
display: flex;
flex-direction: column;
justify-content: space-around;
}
`;

const CenterBox = ({ children }) => {
return <CenterBoxParent>{children}</CenterBoxParent>;
};

export default CenterBox;
9 changes: 0 additions & 9 deletions src/components/CenterBox/CenterBox.jsx

This file was deleted.

16 changes: 0 additions & 16 deletions src/components/CenterBox/CenterBox.module.css

This file was deleted.

73 changes: 73 additions & 0 deletions src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from "react";
import { Link } from "react-router-dom";
import styled from "styled-components";

import Facebook from "../assets/svg/Facebook";
import GitHub from "../assets/svg/GitHub";
import Google from "../assets/svg/Google";
import Twitter from "../assets/svg/Twitter";

const FooterParent = styled.div`
color: #828282;
display: flex;
flex-direction: column;
align-items: center;
h2 {
font-size: 1rem;
font-weight: 400;
}
a {
color: #2f80ed;
margin-left: 5px;
text-decoration: none;
}
.FooterIcons {
display: flex;
margin: 1rem;
}
.FooterIcons svg:hover {
cursor: pointer;
filter: brightness(0.5);
}
.FooterIcons svg:not(:last-of-type) {
margin-right: 1.2rem;
}
`;

const Footer = ({ type }) => {
let bottomText;

if (type === "login") {
bottomText = (
<h2>
Don't have an account yet?<Link to="/signup">Register</Link>
</h2>
);
} else if (type === "signup") {
bottomText = (
<h2>
Already a member?<Link to="/login">Login</Link>
</h2>
);
}

return (
<FooterParent>
<h2>or continue with these social profiles</h2>
<div className="FooterIcons">
<Facebook />
<GitHub />
<Google />
<Twitter />
</div>
{bottomText}
</FooterParent>
);
};

export default Footer;
Loading

0 comments on commit bd9c2d4

Please sign in to comment.