Skip to content

Commit 52ce015

Browse files
committed
added material-ui to app
1 parent d87fbc4 commit 52ce015

6 files changed

Lines changed: 268 additions & 11 deletions

File tree

package-lock.json

Lines changed: 243 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"author": "gaurav sharma",
1616
"license": "ISC",
1717
"dependencies": {
18+
"@material-ui/core": "^4.11.0",
19+
"@material-ui/icons": "^4.9.1",
1820
"axios": "^0.19.0",
1921
"babel-core": "^6.26.3",
2022
"babel-loader": "^7.1.5",

src/client/app/routes/Account/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Dashboard from '../Dashboard';
1010
import Image from '../../components/Image';
1111
import logo from '../../assets/images/logo.png';
1212
import './index.scss';
13-
13+
import ExitToAppIcon from '@material-ui/icons/ExitToApp';
1414

1515
const Account = (props) => {
1616

@@ -60,8 +60,8 @@ const Account = (props) => {
6060
<section className="navigationMenu">
6161
<p className="navigationHeader">Account</p>
6262
<button name='logout' className={`navigationItem ${active === navigationIndexer.constants ? 'activeItem' : ''}`} onClick={handleLogout}>
63-
<FontAwesome id='logout' name="sign-out" onClick={handleSwitch} />&nbsp; Logout
64-
</button>
63+
<span className="content-center"><ExitToAppIcon fontSize="small" id='logout' name="sign-out" onClick={handleSwitch} />&nbsp; Logout</span>
64+
</button>
6565
</section>
6666
</section>
6767
<section className='dynamicContainer'>

src/client/app/routes/LandingPage/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
* @desc this is the admin component of the application.
33
* @author gaurav sharma
44
*/
5-
import React, { useEffect } from 'react';
5+
import React, { useEffect, useState } from 'react';
66

77
import { connect } from 'react-redux';
88
import { userLogin } from '../../redux/actions';
99
import { toast, ToastContainer } from 'react-toastify';
10-
import FontAwesome from 'react-fontawesome';
10+
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
1111

1212
import LoadingOverlay from '../../components/LoadingOverlay';
1313

1414
import './index.scss';
1515

1616

1717
const LandingPage = (props) => {
18+
const [user, setUser] = useState("")
19+
const [password, setPassword] = useState("")
20+
1821
useEffect(() => {
1922
if (localStorage.getItem('data')) {
2023
window.location = '/adminAccount';
@@ -44,8 +47,7 @@ const LandingPage = (props) => {
4447
const onLogin = (e) => {
4548
e.preventDefault();
4649
const { triggerLoginUser } = props;
47-
48-
triggerLoginUser(userUname.value, userPass.value);
50+
triggerLoginUser(user, password);
4951
}
5052

5153
/**
@@ -66,6 +68,9 @@ const LandingPage = (props) => {
6668
}
6769
}
6870

71+
const onFormValid = () => {
72+
return user && password
73+
}
6974

7075
const { fetching, login } = props;
7176
{ login && responseHandler() }
@@ -83,13 +88,15 @@ const LandingPage = (props) => {
8388
<section className='user-login' id='user-login'>
8489

8590
<label htmlFor="username">Username</label><br />
86-
<input ref={userUname => userUname = userUname} className='custom-field login-field' placeholder='Username for user' />
91+
<input onChange={e => setUser(e.target.value)} className='custom-field login-field' placeholder='Username for user' />
8792

8893
<label htmlFor="username">Password</label><br />
89-
<input ref={userPass => userPass = userPass} type='password' className='custom-field login-field' placeholder='Password for user' />
94+
<input onChange={e => setPassword(e.target.value)} type='password' className='custom-field login-field' placeholder='Password for user' />
9095

9196
<p className='text-center'>
92-
<button className="litnite-btn" onClick={onLogin}>LOGIN&nbsp;&nbsp;&nbsp;<FontAwesome name="chevron-right" /></button>
97+
<button className="litnite-btn" onClick={onLogin} disabled={!onFormValid()}><span className="content-center">
98+
LOGIN&nbsp;<ChevronRightIcon />
99+
</span></button>
93100
</p>
94101

95102
<br /><br /><br />

src/client/app/routes/LandingPage/index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@
5555
.form-container{
5656
max-width: 616px;
5757
margin: 0 auto;
58-
}
58+
}
59+

src/client/app/styles/globals.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,7 @@ $global_white_color: #fff;
146146
min-height: 300px;
147147
}
148148

149+
.content-center {
150+
display: flex;
151+
align-items: center;
152+
}

0 commit comments

Comments
 (0)