-
Notifications
You must be signed in to change notification settings - Fork 7
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
avinash-mane
wants to merge
40
commits into
master
Choose a base branch
from
feature/react/148/prelogin-dashboard-with-integration-of-login-form
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 2fd5485
add button core component
jitendrasbunde d332d05
add Label core component
jitendrasbunde 66b3619
restructure of core component
jitendrasbunde 105d5a1
add test case files of button and core components
jitendrasbunde 88c8d34
add video core component with test file
jitendrasbunde 6f75d07
update directory structure in src
jitendrasbunde b5ffea9
update the component path in core componet test files
jitendrasbunde c5359f9
added shared component for login form
avinash-mane 9c9b69d
added react-bootstrap component
avinash-mane e0dffd1
change directory structure
avinash-mane 6b12224
add styled in text component
avinash-mane bee20cc
change component structure
avinash-mane 6f2c021
resolve comments
avinash-mane b5dbabe
change component name
avinash-mane e09995b
addedshared component for peerly logo
onkar-josh 282b04f
added shared components
onkar-josh b00aa96
added file updations
onkar-josh 38cc0e6
changes in pre login component
avinash-mane 93d8bc0
added Prelogin component and test cases
avinash-mane ce9a3c4
add style for pre login component
avinash-mane d411547
add style for pre login component
avinash-mane 1c706bf
added responsive component for mobile
avinash-mane a46a041
resolve comments
avinash-mane 9d8ef1e
added primary core value component
avinash-mane 669a9b9
resolve comments
avinash-mane 7d63836
added snapshot test for component
avinash-mane f4c3078
added theme as a props
avinash-mane d7f94d7
changed theme color
avinash-mane c6941ef
resolved commit
avinash-mane 35dfb3b
added test case for login image component
avinash-mane 258b6ee
remove row and col from component
avinash-mane 7598fb0
added snapshot test case
avinash-mane c371bde
resolved comments
avinash-mane 65e05ee
change component name
avinash-mane 9deced5
update snapshot of component
avinash-mane 6550d42
change size of logo
avinash-mane dbdf52d
change in image test case
avinash-mane 3efda4f
change test case for image component
avinash-mane bd0ad44
change test case for image component
avinash-mane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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.
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,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); |
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,18 @@ | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
|
||
import LoginImageComponent from "login/LoginImageComponent"; | ||
|
||
describe("Image component test", () => { | ||
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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use IMG_BASE_PATH this here |
||
}); | ||
}); |
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,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); |
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"; | ||
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(); | ||
}); | ||
}); |
94 changes: 94 additions & 0 deletions
94
react-frontend/src/login/__snapshots__/MobileDashboardComponent.test.js.snap
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,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> | ||
`; |
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?