Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
aadca0d
Extract project title from Home to a separate component
OlgaBilogurova Nov 4, 2020
162485c
Create Input component with props
OlgaBilogurova Nov 4, 2020
cc5d6f9
Update styles for Title
OlgaBilogurova Nov 4, 2020
c53fe3b
Create Login component
OlgaBilogurova Nov 4, 2020
d3ca09a
Added styles when button is disabled
OlgaBilogurova Nov 5, 2020
338ec9d
Create reducer to disable/activate elements
OlgaBilogurova Nov 5, 2020
4697032
Create types for activate/disable elements and reset state
OlgaBilogurova Nov 5, 2020
ae35af8
Create resetActions and elementActions
OlgaBilogurova Nov 5, 2020
498f7b8
Update authReducer with new types
OlgaBilogurova Nov 5, 2020
e385eab
Update authActions with new types
OlgaBilogurova Nov 5, 2020
292b844
Add additional props to button and input component
OlgaBilogurova Nov 5, 2020
0c88922
Create Login component, connect it to redux store,
OlgaBilogurova Nov 5, 2020
fdd3dc0
Create rootReducer to reset redux state to initial
OlgaBilogurova Nov 5, 2020
4df99cf
Reset sign-in button state from Home
OlgaBilogurova Nov 5, 2020
fcccaed
Create static method to validate inputted symbols using RegExp
OlgaBilogurova Nov 6, 2020
ded3681
Add italic-bold, italic-semibold fonts; @font-face to _fonts
OlgaBilogurova Nov 6, 2020
3f98842
Create ErrorMessage component, add a new element, update ui kit
OlgaBilogurova Nov 7, 2020
97a8d7d
Remove actions and reducer for disable element
OlgaBilogurova Nov 7, 2020
a5077b7
Separate logic from view
OlgaBilogurova Nov 7, 2020
0220344
Add setupProxy.js
OlgaBilogurova Nov 9, 2020
59ab12a
Create UserService and fetch data from API
OlgaBilogurova Nov 9, 2020
66a3658
Add logic to save user data to redux store, and redirect user
OlgaBilogurova Nov 9, 2020
53e56d3
Create userActions.js, userReducer.js
OlgaBilogurova Nov 9, 2020
b313b82
Add new types to store
OlgaBilogurova Nov 9, 2020
4154b19
Remove unuseful state and reducers
OlgaBilogurova Nov 9, 2020
7dd2d38
Update styles, add responsive
OlgaBilogurova Nov 9, 2020
51c2fb1
Add tests to LoginView component
OlgaBilogurova Nov 9, 2020
7382de5
Merge branch 'development' into 386-implement-sign-in-page
OlgaBilogurova Nov 9, 2020
3a67437
Add custom headers
OlgaBilogurova Nov 10, 2020
1cab32a
Merge branch 'development' into 386-implement-sign-in-page
alex-anakin Nov 10, 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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 16 additions & 2 deletions client-mvp-04/src/components/common/button/button.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import React from 'react';
import './button.scss';

const Button = ({ content, className }) => {
const Button = ({
content,
className,
disabled,
onClick,
type,
dataTestid,
}) => {
if (!dataTestid) dataTestid = 'button';
return (
<button data-testid="button" className={className}>
<button
data-testid={dataTestid}
className={className}
type={type}
disabled={disabled}
onClick={onClick}
>
{content}
</button>
);
Expand Down
11 changes: 11 additions & 0 deletions client-mvp-04/src/components/common/errorMessage/errorMessage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

const ErrorMessage = ({ content }) => {
return (
<p data-testid="error-message" className="error-message">
{content}
</p>
);
};

export default ErrorMessage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import ErrorMessage from './errorMessage';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';

describe('Error Message', () => {
test('Should render with text content and className', () => {
render(<ErrorMessage content={'Test content'} />, {
wrapper: BrowserRouter,
});
expect(screen.getByTestId('error-message')).toBeInTheDocument();
expect(screen.getByText('Test content')).toBeInTheDocument();
expect(screen.getByTestId('error-message')).toHaveClass('error-message');
});
});
19 changes: 19 additions & 0 deletions client-mvp-04/src/components/common/input/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

const Input = ({ placeholder, type, onChange, autoComplete, dataTestid }) => {
if (!dataTestid) dataTestid = 'default-input';
return (
<div className="text-field-container">
<input
data-testid={dataTestid}
type={type}
name="default-input"
placeholder={placeholder}
onChange={onChange}
autoComplete={autoComplete}
/>
</div>
);
};

export default Input;
24 changes: 24 additions & 0 deletions client-mvp-04/src/components/common/input/input.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import Input from './input';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';

describe('DefaultInput', () => {
test('Should render with props', () => {
const { getByTestId } = render(
<Input type="text" placeholder="Some text" />,
{ wrapper: BrowserRouter }
);

expect(screen.getByTestId('default-input')).toBeInTheDocument();
expect(getByTestId('default-input')).toHaveAttribute('type', 'text');
expect(getByTestId('default-input')).toHaveAttribute(
'name',
'default-input'
);
expect(getByTestId('default-input')).toHaveAttribute(
'placeholder',
'Some text'
);
});
});
13 changes: 13 additions & 0 deletions client-mvp-04/src/components/common/title/title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import './title.scss';

const Title = () => {
return (
<div data-testid="title" className="title-container">
<h1 className="title-short">VRMS</h1>
<h2 className="title-long">Volunteer Relationship Management System</h2>
</div>
);
};

export default Title;
39 changes: 39 additions & 0 deletions client-mvp-04/src/components/common/title/title.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@import "../../../sass/variables";

.title-container {
margin-left: 35px;
text-align: left;
text-transform: uppercase;

.title-short {
font-size: 72px;
}

.title-long {
margin-top: 26px;
line-height: 27px;
font-weight: $font-regular;
}
}

@media (max-width: 400px) {
.title-container {
.title-long {
margin-top: 18px;
}

.title-short {
font-size: 68px;
}
}
}

@media (max-width: 350px) {
.title-container {
margin-left: 25px;

.title-long {
margin: 15px;
}
}
}
15 changes: 15 additions & 0 deletions client-mvp-04/src/components/common/title/title.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import Title from './title';

describe('ProjectTitle', () => {
test('Should render component with name of project', () => {
render(<Title />, { wrapper: BrowserRouter });
expect(screen.getByTestId('title')).toBeInTheDocument();
const h1 = screen.getByText(/VRMS/i);
const h2 = screen.getByText(/Volunteer Relationship Management System/i);
expect(h1).toBeInTheDocument();
expect(h2).toBeInTheDocument();
});
});
6 changes: 3 additions & 3 deletions client-mvp-04/src/components/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React from 'react';
import './home.scss';
import Button from '../common/button/button';
import RedirectLink from '../common/link/link';
import Title from '../common/title/title';

const Home = () => {
return (
<section data-testid="home" className="home-container">
<h1 className="home-name">VRMS</h1>
<h2 className="home-title">Volunteer Relationship Management System</h2>
<Title />

<RedirectLink
path={'/page'}
path={'/login'}
content={<Button content={`Sign in`} className={`home-button`} />}
linkKey={'sign-in-link'}
/>
Expand Down
47 changes: 18 additions & 29 deletions client-mvp-04/src/components/home/home.scss
Original file line number Diff line number Diff line change
@@ -1,53 +1,42 @@
@import "../../sass/variables";

.home-container {
padding: 40px 90px;

.home-name {
font-size: 72px;
}

.home-title {
margin: 26px 0 83px;
line-height: 27px;
font-weight: $font-regular;
text-align: left;
text-transform: uppercase;
}
padding: 40px 60px;

.home-button {
padding: 6px 40px;
margin-top: 83px;
}
}

.home-text {
display: flex;
justify-content: center;
font-size: 15px;
font-weight: $font-bold;
@media (max-height: 896px) {
.home-container {
height: calc(100vh - 160px);
}
}

@media (max-width: 400px) {
.home-container {
padding: 40px 70px;
}
padding: 25px 52px;

.home-container .home-title {
margin: 18px 0 40px;
.home-button {
margin-top: 60px;
}
}
}

.home-container .home-name {
font-size: 68px;
text-align: left;
@media (max-width: 374px) {
.home-container {
height: calc(100vh - 180px);
}
}

@media (max-width: 350px) {
.home-container {
padding: 15px 52px;
}
padding: 15px 25px;

.home-container .home-title {
margin: 15px 0 35px;
.home-button {
margin-top: 35px;
}
}
}
4 changes: 2 additions & 2 deletions client-mvp-04/src/components/home/home.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ describe('Home', () => {
</Router>
);
expect(screen.getByText('Sign in')).toBeInTheDocument();
expect(screen.getAllByTestId('link')[0]).toHaveAttribute('href', '/page');
expect(screen.getAllByTestId('link')[0]).toHaveAttribute('href', '/login');
fireEvent.click(screen.getAllByTestId('link')[0]);
expect(history.location.pathname).toBe('/page');
expect(history.location.pathname).toBe('/login');
});

test('Should navigate to dummy page after click on `Create account` button', () => {
Expand Down
67 changes: 67 additions & 0 deletions client-mvp-04/src/components/login/login.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@import "../../sass/variables";

.login-container {
padding: 40px 60px;

.text-field-container {
margin-top: 76px;
}

.login-button {
margin: 50px 10px 20px auto;
}

.error-message {
margin: 25px 10px 10px;

.redirect-link {
color: $link-accent-color;
}
}
}

@media (max-height: 896px) {
.login-container {
height: calc(100vh - 160px);
}
}

@media (max-width: 400px) {
.login-container {
padding: 25px 52px;

.login-button {
margin: 40px 0 20px auto;
}

.error-message {
margin: 25px 0 10px;
}

.text-field-container {
margin-top: 55px;
}
}
}

@media (max-width: 374px) {
.login-container {
height: calc(100vh - 180px);
}
}

@media (max-width: 350px) {
.login-container {
padding: 15px 25px;

.text-field-container {
margin-top: 25px;
}
.login-button {
margin: 15px 0 10px auto;
}
.error-message {
margin: 20px 0 5px;
}
}
}
Loading