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

add styling for login form component #149

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
edb613a
add button core component
jitendrasbunde May 19, 2020
ac460fb
add button core component
jitendrasbunde May 19, 2020
e462563
add Label core component
jitendrasbunde May 19, 2020
7b1d6fe
restructure of core component
jitendrasbunde May 19, 2020
f72b845
add test case files of button and core components
jitendrasbunde May 19, 2020
0fca63e
add video core component with test file
jitendrasbunde May 19, 2020
913d021
update directory structure in src
jitendrasbunde May 20, 2020
dc35a9f
update the component path in core componet test files
jitendrasbunde May 20, 2020
8075377
update button core component path in ButtonComponent test file
jitendrasbunde May 20, 2020
30e479a
resolved comment's on PR and add core-component for Row Col
jitendrasbunde May 25, 2020
3c58e4c
separate import module and third party module using add empty line
jitendrasbunde May 25, 2020
d05254d
change button core component and resolve comment on PR
jitendrasbunde May 25, 2020
58d2974
create a grid component for export Row Col core component instead of …
jitendrasbunde May 26, 2020
8b95d62
addedshared component for peerly logo
onkar-josh May 19, 2020
f01be9b
added shared components
onkar-josh May 20, 2020
0a94aa4
added file updations
onkar-josh May 20, 2020
71771f3
removed black text and implemented white
onkar-josh May 20, 2020
b202003
followed directory structure
onkar-josh May 21, 2020
bcc314e
removed old directory structure
onkar-josh May 21, 2020
df3f4d5
updated Peerly logo component with logo
onkar-josh May 25, 2020
321b44e
updated file with style guides
onkar-josh May 25, 2020
917083e
updated logo component by adding core component wrapper over it
onkar-josh May 25, 2020
8c04e91
changed text colour
onkar-josh May 25, 2020
7e7d1a8
added shared component for login form
avinash-mane May 19, 2020
94b9e60
added react-bootstrap component
avinash-mane May 20, 2020
3a595f5
change directory structure
avinash-mane May 20, 2020
7d5755b
add styled in text component
avinash-mane May 21, 2020
40f9895
add login form panel component with logo and button
jitendrasbunde May 20, 2020
7465180
add LoginTextComponent and create component mobile responsive
jitendrasbunde May 20, 2020
0e1c030
add test case file for LoginPanel
jitendrasbunde May 20, 2020
9409624
change position of LoginPanel Component
jitendrasbunde May 21, 2020
470bf52
Delete empty div in LoginPanel
jitendrasbunde May 21, 2020
fd2f900
add some test for LoginPanel Component
jitendrasbunde May 21, 2020
670f10a
optimism loginPanel code and change place of login component
jitendrasbunde May 21, 2020
0e916a4
rename Styling div component into Wrapper
jitendrasbunde May 21, 2020
2a0dfd2
remove css media query and add bootstrap class for responsive LoginPa…
jitendrasbunde May 22, 2020
bd41ab0
use Col component form core component in LoginPanel
jitendrasbunde May 25, 2020
043a6ed
resolve comment on file LoginTextComponent.js, LoginTextComponent.tex…
jitendrasbunde May 25, 2020
dda0417
fixed indentation on LogoComponent
jitendrasbunde May 25, 2020
5ffb41f
Update Sign in button in LoginPanel as per button core component
jitendrasbunde May 26, 2020
a008cdd
change import statement for col core component in LoginPanel, LogoCom…
jitendrasbunde May 26, 2020
9b701f9
get rebase of fresh master and delete an nessaery necessary files
jitendrasbunde Jun 4, 2020
04119c9
add GoogleButton Component for Google Sign in
jitendrasbunde Jun 4, 2020
dfc7beb
add Google Button into LoginPanal and resolve all comment onn PR
jitendrasbunde Jun 4, 2020
e43156a
add react-google-login npm package for google login Component
jitendrasbunde Jun 4, 2020
cc982b6
delete extra files which is not use
jitendrasbunde Jun 8, 2020
3811b22
use a env variable for clientId props for google login button
jitendrasbunde Jun 8, 2020
0ab972c
add snapshot test case for google login button
jitendrasbunde Jun 8, 2020
a949ed3
add snapshot file of test case in login
jitendrasbunde Jun 8, 2020
67e15f1
add peerly.env.local file to give env variable details
jitendrasbunde Jun 8, 2020
5c612f4
all component Wrap in React memo
jitendrasbunde Jun 8, 2020
7bd2390
set css color at Login panel background atomic and update snapshot
jitendrasbunde Jun 8, 2020
4069360
delete peerly.env.local
jitendrasbunde Jun 8, 2020
6ce2df5
resolve comment's on LoginPanel Component and update test case
jitendrasbunde Jun 8, 2020
b53e5b0
add google cookie policy set as env variable
jitendrasbunde Jun 8, 2020
8870a97
remove informative text and encouragementThought text as props
jitendrasbunde Jun 8, 2020
fff96ac
add height for loginpanel and wrapper Div in container
jitendrasbunde Jun 9, 2020
b96887b
update snapshot of LoginPanel.test.js
jitendrasbunde Jun 9, 2020
29813e9
update Login Panel component remove all extra style for equal height …
jitendrasbunde Jun 11, 2020
e610d3d
add snapshot of LoginPanel for test case
jitendrasbunde Jun 11, 2020
aeb6c52
add env variable into addConstants.js file and use in GoogleLoginButt…
jitendrasbunde Jun 11, 2020
bb4f37a
add package-lock.json for react-google-login npm package
jitendrasbunde Jun 11, 2020
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
9 changes: 9 additions & 0 deletions react-frontend/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 react-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"react": "^16.13.1",
"react-bootstrap": "^1.0.0",
"react-dom": "^16.13.1",
"react-google-login": "^5.1.20",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
Expand Down
4 changes: 4 additions & 0 deletions react-frontend/src/constants/appConstants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export const REDIRECT_TIMEOUT = 3000;

export const IMG_BASE_PATH = `${process.env.PUBLIC_URL}/assets/images/`;

export const GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID;

export const GOOGLE_COOKIE_POLICY = process.env.REACT_APP_GOOGLE_COOKIE_POLICY;
31 changes: 31 additions & 0 deletions react-frontend/src/login/GoogleLoginButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import PropTypes from "prop-types";
import GoogleLogin from "react-google-login";

import { GOOGLE_CLIENT_ID, GOOGLE_COOKIE_POLICY } from "constants/appConstants";

const GoogleLoginButtonComponent = ({
responseGoogleOnSuccess,
responseGoogleOnFailure,
buttonText,
}) => (
<GoogleLogin
clientId={GOOGLE_CLIENT_ID}
buttonText={buttonText}
onSuccess={responseGoogleOnSuccess}
onFailure={responseGoogleOnFailure}
cookiePolicy={GOOGLE_COOKIE_POLICY}
/>
);

GoogleLoginButtonComponent.defaultProps = {
buttonText: "Sign in with google",
};

GoogleLoginButtonComponent.propTypes = {
responseGoogleOnSuccess: PropTypes.func.isRequired,
responseGoogleOnFailure: PropTypes.func.isRequired,
buttonText: PropTypes.string,
};

export default React.memo(GoogleLoginButtonComponent);
20 changes: 20 additions & 0 deletions react-frontend/src/login/GoogleLoginButton.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { render } from "@testing-library/react";

import GoogleLoginButton from "login/GoogleLoginButton";

test("GoogleLoginButton should pass a snapshot", () => {
const responseCheckFunction = () => {
return true;
};

const { asFragment } = render(
<GoogleLoginButton
buttonText="Google Sign in"
responseGoogleOnFailure={responseCheckFunction}
responseGoogleOnSuccess={responseCheckFunction}
/>
);

expect(asFragment()).toMatchSnapshot();
});
44 changes: 44 additions & 0 deletions react-frontend/src/login/LoginPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from "react";
import PropTypes from "prop-types";
import styled from "styled-components";

import PeerlyTextAndLogo from "shared-components/peerly-logo/PeerlyTextAndLogo";
import InformativeTextComponent from "login/InformativeTextComponent";
import { Container } from "core-components/grid/GridComponent";
import GoogleLoginButton from "login/GoogleLoginButton";

const WrapperContainer = styled(Container)`
height: 100vh;
background-color: var(--atomic);
`;

const LoginPanel = ({ responseGoogleOnSuccess, responseGoogleOnFailure }) => (
<WrapperContainer
className="flex-column justify-content-around d-flex"
fluid={true}
>
<div className="mb-5">
<PeerlyTextAndLogo theme="dark" />
</div>
<div className="text-center mb-3 pb-4">
<GoogleLoginButton
responseGoogleOnSuccess={responseGoogleOnSuccess}
responseGoogleOnFailure={responseGoogleOnFailure}
buttonText="Google sign in"
></GoogleLoginButton>
</div>
<InformativeTextComponent
className="d-none d-md-block d-lg-block mt-4"
theme="dark"
informativeText="Lets Create the Office Positive"
encouragementThought="Encouragement Driven"
/>
</WrapperContainer>
);

LoginPanel.propTypes = {
responseGoogleOnSuccess: PropTypes.func.isRequired,
responseGoogleOnFailure: PropTypes.func.isRequired,
};

export default React.memo(LoginPanel);
18 changes: 18 additions & 0 deletions react-frontend/src/login/LoginPanel.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import { render } from "@testing-library/react";

import LoginPanel from "login/LoginPanel";

test("LoginPanel should pass a snapshot", () => {
const responseCheckFunction = () => {
return true;
};

const { asFragment } = render(
<LoginPanel
responseGoogleOnFailure={responseCheckFunction}
responseGoogleOnSuccess={responseCheckFunction}
/>
);
expect(asFragment()).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`GoogleLoginButton should pass a snapshot 1`] = `
<DocumentFragment>
<button
disabled=""
style="background-color: rgb(255, 255, 255); display: inline-flex; align-items: center; color: rgba(0, 0, 0, 0.54); box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .24), 0 0 1px 0 rgba(0, 0, 0, .24); padding: 0px; border-radius: 2px; border: 1px solid transparent; font-size: 14px; font-weight: 500; font-family: Roboto, sans-serif; opacity: 0.6;"
type="button"
>
<div
style="margin-right: 10px; background: rgb(255, 255, 255); padding: 10px; border-radius: 2px;"
>
<svg
height="18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill="#000"
fill-rule="evenodd"
>
<path
d="M9 3.48c1.69 0 2.83.73 3.48 1.34l2.54-2.48C13.46.89 11.43 0 9 0 5.48 0 2.44 2.02.96 4.96l2.91 2.26C4.6 5.05 6.62 3.48 9 3.48z"
fill="#EA4335"
/>
<path
d="M17.64 9.2c0-.74-.06-1.28-.19-1.84H9v3.34h4.96c-.1.83-.64 2.08-1.84 2.92l2.84 2.2c1.7-1.57 2.68-3.88 2.68-6.62z"
fill="#4285F4"
/>
<path
d="M3.88 10.78A5.54 5.54 0 0 1 3.58 9c0-.62.11-1.22.29-1.78L.96 4.96A9.008 9.008 0 0 0 0 9c0 1.45.35 2.82.96 4.04l2.92-2.26z"
fill="#FBBC05"
/>
<path
d="M9 18c2.43 0 4.47-.8 5.96-2.18l-2.84-2.2c-.76.53-1.78.9-3.12.9-2.38 0-4.4-1.57-5.12-3.74L.97 13.04C2.45 15.98 5.48 18 9 18z"
fill="#34A853"
/>
<path
d="M0 0h18v18H0z"
fill="none"
/>
</g>
</svg>
</div>
<span
style="font-weight: 500; padding: 10px 10px 10px 0px;"
>
Google Sign in
</span>
</button>
</DocumentFragment>
`;
147 changes: 147 additions & 0 deletions react-frontend/src/login/__snapshots__/LoginPanel.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`LoginPanel should pass a snapshot 1`] = `
<DocumentFragment>
.c2 {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
font-size: 48px;
color: var(--white);
}

.c1 {
text-align: center;
margin-top: 15px;
width: 83px;
height: 83px;
border: 3px solid var(--white);
background-color: var(--atomic);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}

.c3 {
color: var(--white);
background-color: var(--atomic);
font-size: 48px;
}

.c5 {
width: 10%;
background: var(--white);
}

.c4 {
color: var(--white);
background-color: var(--atomic);
}

.c0 {
height: 100vh;
background-color: var(--atomic);
}

<div
class="c0 flex-column justify-content-around d-flex container-fluid"
>
<div
class="mb-5"
>
<div
data-testid="peerlyLogoComponent"
>
<div
class="c1 mx-auto"
data-testid="Logo"
>
<div
class="c2"
data-testid="plusSignText"
font-size="48px"
>
+
</div>
</div>
</div>
<div
class="text-center"
>
<div
class="c3"
data-testid="PeerlyTextComponents"
font-size="48px"
>
Peerly
</div>
</div>
</div>
<div
class="text-center mb-3 pb-4"
>
<button
disabled=""
style="background-color: rgb(255, 255, 255); display: inline-flex; align-items: center; color: rgba(0, 0, 0, 0.54); box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .24), 0 0 1px 0 rgba(0, 0, 0, .24); padding: 0px; border-radius: 2px; border: 1px solid transparent; font-size: 14px; font-weight: 500; font-family: Roboto, sans-serif; opacity: 0.6;"
type="button"
>
<div
style="margin-right: 10px; background: rgb(255, 255, 255); padding: 10px; border-radius: 2px;"
>
<svg
height="18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill="#000"
fill-rule="evenodd"
>
<path
d="M9 3.48c1.69 0 2.83.73 3.48 1.34l2.54-2.48C13.46.89 11.43 0 9 0 5.48 0 2.44 2.02.96 4.96l2.91 2.26C4.6 5.05 6.62 3.48 9 3.48z"
fill="#EA4335"
/>
<path
d="M17.64 9.2c0-.74-.06-1.28-.19-1.84H9v3.34h4.96c-.1.83-.64 2.08-1.84 2.92l2.84 2.2c1.7-1.57 2.68-3.88 2.68-6.62z"
fill="#4285F4"
/>
<path
d="M3.88 10.78A5.54 5.54 0 0 1 3.58 9c0-.62.11-1.22.29-1.78L.96 4.96A9.008 9.008 0 0 0 0 9c0 1.45.35 2.82.96 4.04l2.92-2.26z"
fill="#FBBC05"
/>
<path
d="M9 18c2.43 0 4.47-.8 5.96-2.18l-2.84-2.2c-.76.53-1.78.9-3.12.9-2.38 0-4.4-1.57-5.12-3.74L.97 13.04C2.45 15.98 5.48 18 9 18z"
fill="#34A853"
/>
<path
d="M0 0h18v18H0z"
fill="none"
/>
</g>
</svg>
</div>
<span
style="font-weight: 500; padding: 10px 10px 10px 0px;"
>
Google sign in
</span>
</button>
</div>
<div
class="c4 text-center d-none d-md-block d-lg-block mt-4"
data-testid="info"
>
<h3>
Lets Create the Office Positive
</h3>
<hr
class="c5"
data-testid="hrLine"
/>
<h6>
Encouragement Driven
</h6>
</div>
</div>
</DocumentFragment>
`;