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

Removed Instances of useStyles, Replaced With SCSS #440

Merged
merged 5 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
36 changes: 6 additions & 30 deletions frontend/client/src/components/NavBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useState } from 'react'
import { Redirect, Link } from 'react-router-dom'
import { makeStyles } from '@material-ui/core/styles'
import IconButton from '@material-ui/core/IconButton'
import MenuItem from '@material-ui/core/MenuItem'
import Menu from '@material-ui/core/Menu'
Expand All @@ -11,30 +10,7 @@ import { withStore } from '../store'
import { observer } from 'mobx-react'
import menu from '../../assets/menu.svg'

const useStyles = makeStyles((theme) => ({
root: {
flexGrow: 1,
},
menuButton: {
marginRight: theme.spacing(11),
},
title: {
flexGrow: 1,
},
link: {
marginTop: 14,
paddingLeft: 30,
paddingRight: 30,
fontFamily: 'Montserrat',
fontSize: 18,
fontWeight: 500,
color: '#2c58b1',
},
}))

const NavBarBase = observer((props) => {
const classes = useStyles()

const [redirect, setRedirect] = useState(-1)
const [anchorEl, setAnchorEl] = useState(null)
const open = Boolean(anchorEl)
Expand Down Expand Up @@ -72,7 +48,7 @@ const NavBarBase = observer((props) => {
</div>
<div className="avatar_group separator" />

<IconButton edge="start" className={classes.menuButton} color="inherit" aria-label="menu" onClick={handleMenu}>
<IconButton edge="start" className="menu-btn" color="inherit" aria-label="menu" onClick={handleMenu}>
<img src={menu} alt="Menu" />
</IconButton>
<Menu
Expand All @@ -90,23 +66,23 @@ const NavBarBase = observer((props) => {
open={open}
onClose={handleClose}
>
<MenuItem className={classes.link} style={{ marginTop: 22 }} onClick={() => onClickMenuItem(0)}>
<MenuItem className="menu-link" style={{ marginTop: 22 }} onClick={() => onClickMenuItem(0)}>
Diagnosis Verification Codes
</MenuItem>
{props.store.data.user.isAdmin && (
<MenuItem className={classes.link} onClick={() => onClickMenuItem(1)}>
<MenuItem className="menu-link" onClick={() => onClickMenuItem(1)}>
Manage Members
</MenuItem>
)}
{props.store.data.user.isAdmin && (
<MenuItem className={classes.link} onClick={() => onClickMenuItem(2)}>
<MenuItem className="menu-link" onClick={() => onClickMenuItem(2)}>
Mobile App Settings
</MenuItem>
)}
<MenuItem className={classes.link} onClick={() => onClickMenuItem(3)}>
<MenuItem className="menu-link" onClick={() => onClickMenuItem(3)}>
My Settings
</MenuItem>
<MenuItem className={classes.link} style={{ marginBottom: 22 }} onClick={() => onClickMenuItem(4)}>
<MenuItem className="menu-link" style={{ marginBottom: 22 }} onClick={() => onClickMenuItem(4)}>
Logout
</MenuItem>
</Menu>
Expand Down
32 changes: 1 addition & 31 deletions frontend/client/src/screens/Settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useRef, Fragment, useState } from 'react'
import Grid from '@material-ui/core/Grid'
import Modal from '../components/Modal'
import { makeStyles } from '@material-ui/core/styles'
import * as ROLES from '../constants/roles'
import Toast from '../components/Toast'
import { Redirect } from 'react-router-dom'
Expand All @@ -15,31 +14,8 @@ import PendingOperationButton from '../components/PendingOperationButton'
import ResetPasswordModal from '../components/ResetPasswordModal'
import CircularProgress from '@material-ui/core/CircularProgress'

const useStyles = makeStyles({
root: {
marginTop: 10,
padding: 40,
paddingLeft: 8,
},
})

const inputStyles = makeStyles({
root: {
lineHeight: '16px',
borderRadius: 4,
border: '2px solid #BDBDBD',
boxSizing: 'border-box',
width: '75%',
height: 40,
marginTop: 10,
marginBottom: 40,
},
})

const MAXFILESIZE = 10 * 1024 * 1024
const SettingsBase = observer((props) => {
const classes = useStyles()
const input = inputStyles()
const imgUploader = useRef()

const [open, setOpen] = useState(false)
Expand Down Expand Up @@ -174,7 +150,7 @@ const SettingsBase = observer((props) => {
const settingsForm = () => (
<Fragment>
<form>
<Grid container className={classes.root} spacing={2} direction="row" justify="center">
<Grid container id="settings-grid" spacing={2} direction="row" justify="center">
<Grid item xs={4} xl={2}>
<Grid container spacing={2} direction="column">
<label> Profile Photo </label>
Expand Down Expand Up @@ -218,7 +194,6 @@ const SettingsBase = observer((props) => {
type="text"
id="prefix"
name="prefix"
className={input.root}
onChange={onChange}
value={props.store.data.user.prefix}
></input>
Expand All @@ -229,7 +204,6 @@ const SettingsBase = observer((props) => {
name="firstName"
required
aria-required="true"
className={input.root}
onChange={onChange}
value={props.store.data.user.firstName}
></input>
Expand All @@ -241,7 +215,6 @@ const SettingsBase = observer((props) => {
required
disabled={true}
aria-required="true"
className={input.root}
style={{ backgroundColor: '#e0e0e0' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

There are still quite a few lines like this around (style=[something]) that I think can also be moved to scss files. Especially ones like line 158 of this file where lots of styling is done inline.

Copy link
Contributor

Choose a reason for hiding this comment

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

value={props.store.data.user.email}
></input>
Expand All @@ -259,7 +232,6 @@ const SettingsBase = observer((props) => {
disabled={true}
required
aria-required="true"
className={input.root}
style={{ backgroundColor: '#e0e0e0' }}
value={props.store.data.user.isAdmin ? ROLES.ADMIN_LABEL : ROLES.NON_ADMIN_LABEL}
></input>
Expand All @@ -272,7 +244,6 @@ const SettingsBase = observer((props) => {
required
aria-required="true"
onChange={onChange}
className={input.root}
defaultValue={props.store.data.user.lastName}
></input>
<label htmlFor="password">Password</label>
Expand All @@ -284,7 +255,6 @@ const SettingsBase = observer((props) => {
disabled={true}
required
aria-required="true"
className={input.root}
defaultValue=" • • • • • • • •"
></input>
<a
Expand Down
108 changes: 0 additions & 108 deletions frontend/client/src/util/sample.js

This file was deleted.

16 changes: 16 additions & 0 deletions frontend/client/styles/components/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
#orgLogo {
height: 40px;
}

.menu-btn {
margin-right: 88px;
}
}

#menu-appbar {
.menu-link {
font-family: 'Montserrat';
font-size: 18px;
font-weight: 500;
margin-top: 14px;
padding-left: 30px;
padding-right: 30px;
color: #2c58b1;
}
}

#logged-in-icons-container {
Expand Down
2 changes: 1 addition & 1 deletion frontend/client/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
@import './components/modal.scss';
@import './components/modal_input.scss';
@import './components/profile_photo.scss';
@import './components/cancel_confirm_buttons.scss'
@import './components/cancel_confirm_buttons.scss';
17 changes: 17 additions & 0 deletions frontend/client/styles/screens/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,20 @@
margin-top: 60px;
}
}

#settings-grid {
margin: 10px -8px -8px -8px;
padding: 40px;
padding-left: 8px;

input {
line-height: 16px;
border-radius: 4px;
border: 2px solid #BDBDBD;
box-sizing: border-box;
width: 75%;
height: 40px;
margin-top: 10px;
margin-bottom: 40px;
}
}