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

prelogin component for mobile view #150

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
873de26
add button core component
jitendrasbunde May 19, 2020
2fd5485
add button core component
jitendrasbunde May 19, 2020
d332d05
add Label core component
jitendrasbunde May 19, 2020
66b3619
restructure of core component
jitendrasbunde May 19, 2020
105d5a1
add test case files of button and core components
jitendrasbunde May 19, 2020
88c8d34
add video core component with test file
jitendrasbunde May 19, 2020
6f75d07
update directory structure in src
jitendrasbunde May 20, 2020
b5ffea9
update the component path in core componet test files
jitendrasbunde May 20, 2020
c5359f9
added shared component for login form
avinash-mane May 19, 2020
9c9b69d
added react-bootstrap component
avinash-mane May 20, 2020
e0dffd1
change directory structure
avinash-mane May 20, 2020
6b12224
add styled in text component
avinash-mane May 21, 2020
bee20cc
change component structure
avinash-mane May 22, 2020
6f2c021
resolve comments
avinash-mane May 26, 2020
b5dbabe
change component name
avinash-mane May 27, 2020
e09995b
addedshared component for peerly logo
onkar-josh May 19, 2020
282b04f
added shared components
onkar-josh May 20, 2020
b00aa96
added file updations
onkar-josh May 20, 2020
38cc0e6
changes in pre login component
avinash-mane May 21, 2020
93d8bc0
added Prelogin component and test cases
avinash-mane May 21, 2020
ce9a3c4
add style for pre login component
avinash-mane May 22, 2020
d411547
add style for pre login component
avinash-mane May 22, 2020
1c706bf
added responsive component for mobile
avinash-mane May 22, 2020
a46a041
resolve comments
avinash-mane May 26, 2020
9d8ef1e
added primary core value component
avinash-mane May 27, 2020
669a9b9
resolve comments
avinash-mane Jun 4, 2020
7d63836
added snapshot test for component
avinash-mane Jun 8, 2020
f4c3078
added theme as a props
avinash-mane Jun 8, 2020
d7f94d7
changed theme color
avinash-mane Jun 8, 2020
c6941ef
resolved commit
avinash-mane Jun 8, 2020
35dfb3b
added test case for login image component
avinash-mane Jun 8, 2020
258b6ee
remove row and col from component
avinash-mane Jun 9, 2020
7598fb0
added snapshot test case
avinash-mane Jun 9, 2020
c371bde
resolved comments
avinash-mane Jun 10, 2020
65e05ee
change component name
avinash-mane Jun 10, 2020
9deced5
update snapshot of component
avinash-mane Jun 10, 2020
6550d42
change size of logo
avinash-mane Jun 10, 2020
dbdf52d
change in image test case
avinash-mane Jun 11, 2020
3efda4f
change test case for image component
avinash-mane Jun 11, 2020
bd0ad44
change test case for image component
avinash-mane 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
Binary file added react-frontend/public/assets/images/cat-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions react-frontend/src/login/LoginImageComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import PropTypes from "prop-types";
import { IMG_BASE_PATH } from "constants/appConstants";
import ImageComponent from "core-components/image/ImageComponent";

const getImagePath = (size) =>
size === "lg"
? `${IMG_BASE_PATH}/cat-img.png`
: `${IMG_BASE_PATH}/cat-mobile-img.png`;

const LoginImageComponent = ({ className, size }) => {
const imagePath = React.useMemo(() => getImagePath(size), [size]);

return (
<ImageComponent src={imagePath} className={className} alt="login image" />
);
};

LoginImageComponent.propTypes = {
className: PropTypes.string,
size: PropTypes.oneOf(["md", "lg"]),
};

LoginImageComponent.defaultProps = {
size: "md",
};

export default React.memo(LoginImageComponent);
18 changes: 18 additions & 0 deletions react-frontend/src/login/LoginImageComponent.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 LoginImageComponent from "login/LoginImageComponent";

describe("Image component test", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avi4630 - no need to test the size of image rendered, whether props were applied properly or not. Correct?

test("renders image component with image", () => {
const { getByAltText } = render(<LoginImageComponent />);
const testImage = getByAltText("login image");
expect(testImage).toBeInTheDocument();
});

test("render image with correct size", () => {
const { getByAltText } = render(<LoginImageComponent size="lg" />);
const testImage = getByAltText("login image");
expect(testImage.src).toBe("http://localhost/assets/images//cat-img.png");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use IMG_BASE_PATH this here

});
});
26 changes: 26 additions & 0 deletions react-frontend/src/login/MobileDashboardComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import styled from "styled-components";

import PeerlyTextAndLogo from "shared-components/peerly-logo/PeerlyTextAndLogo";
import InformativeTextComponent from "login/InformativeTextComponent";
import LoginImageComponent from "login/LoginImageComponent";

const Wrapper = styled.div`
height: 100vh;
background-color: var(--atomic);
`;

const MobileDashboardComponent = () => (
<Wrapper className="d-md-none flex-column d-flex justify-content-around">
<PeerlyTextAndLogo theme="dark" />
<LoginImageComponent />
<InformativeTextComponent
className="mx-5"
theme="dark"
informativeText="Lets Create the Office Positive"
encouragementThought="Encouragement Driven"
/>
</Wrapper>
);

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

describe("mobile dashboard component test", () => {
test("should render dashboard component", () => {
const { asFragment } = render(<MobileDashboardComponent />);
expect(asFragment()).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`mobile dashboard component test should render dashboard component 1`] = `
<DocumentFragment>
.c2 {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
font-size: 30px;
color: var(--white);
}

.c1 {
text-align: center;
margin-top: 15px;
width: 50px;
height: 50px;
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: 30px;
}

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

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

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

<div
class="c0 d-md-none flex-column d-flex justify-content-around"
>
<div
class="text-center"
>
<div
class="c1 mx-auto"
data-testid="Logo"
>
<div
class="c2"
data-testid="plusSignText"
font-size="30px"
>
+
</div>
</div>
<div
class="c3"
data-testid="PeerlyTextComponents"
font-size="30px"
>
Peerly
</div>
</div>
<img
alt="login image"
class="img-fluid"
src="/assets/images//cat-mobile-img.png"
/>
<div
class="c4 text-center mx-5"
data-testid="info"
>
<h3>
Lets Create the Office Positive
</h3>
<hr
class="c5"
data-testid="hrLine"
/>
<h6>
Encouragement Driven
</h6>
</div>
</div>
</DocumentFragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import PlusSign from "shared-components/plus-sign/PlusSign";
const Logo = styled.div`
text-align: center;
margin-top: 15px;
width: 83px;
height: 83px;
width: 50px;
height: 50px;
border: 3px solid
${({ theme }) => (theme === "dark" ? "var(--white)" : "var(--atomic)")};
background-color: ${({ theme }) =>
Expand All @@ -24,7 +24,7 @@ const PeerlyLogo = ({ theme, fontSize }) => (

PeerlyLogo.defaultProps = {
theme: "dark",
fontSize: "48px",
fontSize: "30px",
};

PeerlyLogo.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ import PeerlyLogo from "shared-components/peerly-logo/PeerlyLogo";
import PeerlyTextComponent from "shared-components/peerly-logo/PeerlyTextComponent";

const PeerlyTextAndLogo = ({ theme, fontSize }) => (
<>
<div data-testid="peerlyLogoComponent">
<PeerlyLogo theme={theme} fontSize={fontSize} />
</div>
<div className="text-center">
<PeerlyTextComponent theme={theme} fontSize={fontSize} />
</div>
</>
<div className="text-center">
<PeerlyLogo theme={theme} fontSize={fontSize} />
<PeerlyTextComponent theme={theme} fontSize={fontSize} />
</div>
);

PeerlyTextAndLogo.defaultProps = {
theme: "dark",
fontSize: "48px",
fontSize: "30px",
};

PeerlyTextAndLogo.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const PeerlyTextComponent = ({ theme, fontSize }) => (

PeerlyTextComponent.defaultProps = {
theme: "dark",
fontSize: "48px",
fontSize: "30px",
};

PeerlyTextComponent.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ exports[`should render PeerlyLogo Component 1`] = `
.c0 {
text-align: center;
margin-top: 15px;
width: 83px;
height: 83px;
width: 50px;
height: 50px;
border: 3px solid var(--white);
background-color: var(--atomic);
-webkit-transform: rotate(45deg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ exports[`should equal to Peerly text 1`] = `
.c0 {
text-align: center;
margin-top: 15px;
width: 83px;
height: 83px;
width: 50px;
height: 50px;
border: 3px solid var(--white);
background-color: var(--atomic);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}

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

<div
data-testid="peerlyLogoComponent"
class="text-center"
>
<div
class="c0 mx-auto"
Expand All @@ -37,18 +43,8 @@ exports[`should equal to Peerly text 1`] = `
+
</div>
</div>
</div>
.c0 {
color: var(--white);
background-color: var(--atomic);
font-size: 48px;
}

<div
class="text-center"
>
<div
class="c0"
class="c2"
data-testid="PeerlyTextComponents"
font-size="48px"
>
Expand Down
2 changes: 1 addition & 1 deletion react-frontend/src/shared-components/plus-sign/PlusSign.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const PlusSign = ({ theme, cross, fontSize }) => (

PlusSign.defaultProps = {
theme: "dark",
fontSize: "48px",
fontSize: "36px",
cross: false,
};

Expand Down