Skip to content

Commit

Permalink
SignUp Page small screen fix. (#144)
Browse files Browse the repository at this point in the history
* Add autochanged tsconfig.

* Make signup page responsive.

* Drop minWidth on dropdowns to prevent overflow.
  • Loading branch information
godwinpang committed Sep 20, 2020
1 parent 61af12d commit 0b2d466
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 112 deletions.
6 changes: 1 addition & 5 deletions src/components/dropdowns/MajorDropdownField/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';

import GenericDropdownField from '../base';

import styles from './styles';

import ELIGIBLE_MAJORS from '@Constants/eligibleMajors';

const createFullMajorTitle = (department, major) => {
Expand Down Expand Up @@ -37,7 +34,6 @@ const MajorDropdownField = props => {

return (
<GenericDropdownField
className={classes.root}
name={name}
label={label}
defaultValue=''
Expand All @@ -57,4 +53,4 @@ MajorDropdownField.defaultProps = {
includeOthers: false,
};

export default withStyles(styles)(MajorDropdownField);
export default MajorDropdownField;
7 changes: 0 additions & 7 deletions src/components/dropdowns/MajorDropdownField/styles.js

This file was deleted.

8 changes: 2 additions & 6 deletions src/components/dropdowns/YearDropdownField/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { getYear } from 'date-fns';
import { withStyles } from '@material-ui/core/styles';

import GenericDropdownField from '../base';

import styles from './styles';

const yearDropdownChoices = (minYear, maxYear) => {
const yearChoices = [];

Expand All @@ -18,11 +15,10 @@ const yearDropdownChoices = (minYear, maxYear) => {
};

const YearDropdownField = props => {
const { classes, name, label, minYear, maxYear, ...otherProps } = props;
const { name, label, minYear, maxYear, ...otherProps } = props;

return (
<GenericDropdownField
className={classes.root}
name={name}
label={label}
{...otherProps}
Expand All @@ -43,4 +39,4 @@ YearDropdownField.defaultProps = {
maxYear: parseInt(getYear(new Date()), 10) + 5,
};

export default withStyles(styles)(YearDropdownField);
export default YearDropdownField;
7 changes: 0 additions & 7 deletions src/components/dropdowns/YearDropdownField/styles.js

This file was deleted.

70 changes: 36 additions & 34 deletions src/pages/SignUpPage/components/SignUpForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ const SignUpForm = props => {
>
{({ submitForm, isSubmitting }) => (
<Form>
<Grid container direction='column' justify='center' spacing={3}>
<Grid container direction='column' justify='center' spacing={2}>
<Grid item>
<Grid container direction='row' spacing={3}>
<Grid container direction='row' spacing={2}>
<Grid item xs={6}>
<Field
component={TextField}
fullWidth
name='firstName'
label='First Name'
/>
Expand All @@ -49,6 +50,7 @@ const SignUpForm = props => {
<Grid item xs={6}>
<Field
component={TextField}
fullWidth
name='lastName'
label='Last Name'
/>
Expand All @@ -57,53 +59,53 @@ const SignUpForm = props => {
</Grid>

<Grid item>
<Grid container direction='column' spacing={3}>
<Grid item>
<Field
component={TextField}
fullWidth
name='email'
label='Email Address'
/>
</Grid>
<Field
component={TextField}
fullWidth
name='email'
label='Email Address'
/>
</Grid>

<Grid item>
<Field
component={TextField}
fullWidth
name='password'
type='password'
label='Password'
/>
</Grid>
<Grid item>
<Field
component={TextField}
fullWidth
name='password'
type='password'
label='Password'
/>
</Grid>

<Grid item>
<Field
component={TextField}
fullWidth
name='confirmPW'
type='password'
label='Confirm Password'
/>
</Grid>
</Grid>
<Grid item>
<Field
component={TextField}
fullWidth
name='confirmPW'
type='password'
label='Confirm Password'
/>
</Grid>

<Grid item>
<Grid container direction='row' spacing={3}>
<Grid container direction='row' spacing={2}>
<Grid item xs={8}>
<MajorDropdownField name='major' label='Major' />
<MajorDropdownField name='major' label='Major' fullWidth />
</Grid>

<Grid item xs={4}>
<YearDropdownField name='gradYear' label='Grad Year' />
<YearDropdownField
name='gradYear'
label='Grad Year'
fullWidth
/>
</Grid>
</Grid>
</Grid>

<Grid item>
<Button
className={classes.signUpButton}
className={classes.signUp}
variant='contained'
color='primary'
fullWidth
Expand Down
4 changes: 2 additions & 2 deletions src/pages/SignUpPage/components/SignUpForm/styles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const styles = () => ({
signUpButton: {
marginTop: '10px',
signUp: {
marginTop: 8,
},
signInRedirect: {
color: '#5B5B5B',
Expand Down
36 changes: 29 additions & 7 deletions src/pages/SignUpPage/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Avatar, Card } from '@material-ui/core';
import { Avatar, Card, Grid, CardContent } from '@material-ui/core';
import { withStyles } from '@material-ui/core/styles';

import SignUpForm from './components/SignUpForm';
Expand Down Expand Up @@ -31,12 +31,34 @@ class SignUpPage extends React.Component {
const { classes } = this.props;

return (
<div className={classes.root}>
<Card className={classes.signUpCard} elevation={3}>
<Avatar className={classes.logo} src={HKN_TRIDENT_LOGO} />
<SignUpForm handleSubmit={this.handleSubmit} />
</Card>
</div>
<Grid
className={classes.root}
container
direction='row'
justify='center'
alignItems='center'
>
<Grid item>
<Card elevation={3} className={classes.card}>
<CardContent>
<Grid
container
className={classes.cardContent}
alignItems='center'
direction='column'
spacing={2}
>
<Grid item>
<Avatar className={classes.logo} src={HKN_TRIDENT_LOGO} />
</Grid>
<Grid item>
<SignUpForm handleSubmit={this.handleSubmit} />
</Grid>
</Grid>
</CardContent>
</Card>
</Grid>
</Grid>
);
}
}
Expand Down
32 changes: 15 additions & 17 deletions src/pages/SignUpPage/styles.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
const styles = () => ({
const styles = theme => ({
root: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
},
signUpCard: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
width: '536px',
marginTop: '37px',
marginBottom: '37px',
paddingBottom: '20px',
[theme.breakpoints.up('sm')]: {
marginTop: '8vh',
},
[theme.breakpoints.only('xs')]: {
marginTop: '3vh',
},
},
logo: {
width: '150px',
height: '107px',
marginTop: '28px',
marginBottom: '40px',
minWidth: '98px',
minHeight: '70px',
width: '14vh',
height: '10vh',
},
cardContent: {
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2),
},
});

Expand Down
54 changes: 27 additions & 27 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"baseUrl": "."
},
"include": [
"src"
],
"extends": "./tsconfig.paths.json"
}
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"baseUrl": "."
},
"include": [
"src"
],
"extends": "./tsconfig.paths.json"
}

0 comments on commit 0b2d466

Please sign in to comment.