Skip to content

Commit

Permalink
Refactorized. Fixed build bug locally. Will test bug in Heroku.
Browse files Browse the repository at this point in the history
  • Loading branch information
VctorAHernndez committed Feb 2, 2020
1 parent 2b5fc83 commit 2ab767c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 34 deletions.
20 changes: 18 additions & 2 deletions client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ header {
}

/* FILTERS */
.keyword-input {
width: 80% !important;
margin: 8px !important;
}

.filter-selects {
margin: 8px !important;
width: 150px;
}

.switch-label {
color: #808080;
}
Expand Down Expand Up @@ -142,7 +152,6 @@ code {
/* FOOTER */
footer {
display: flex;
/* justify-content: center; */
align-items: center;
text-align: center;
width: 100vw;
Expand All @@ -164,9 +173,16 @@ footer {
}

#lead-subtitle {
font-size: 0.7rem;
font-size: 0.75rem;
text-align: center;
margin-top: 0.5rem;
padding: 0 0.8rem;
}

/* FILTERS */
.keyword-input,
.filter-selects {
width: calc(100% - 16px) !important;
}

/* RESTAURANT LIST */
Expand Down
40 changes: 10 additions & 30 deletions client/src/components/Filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ import {
isWidthUp,
withWidth
} from '@material-ui/core/';
import { withStyles } from '@material-ui/core/styles';
import PropTypes from 'prop-types';

const styles = theme => ({
root: {
margin: theme.spacing(1),
width: 150
},
keywords: {
margin: theme.spacing(1),
width: "80%"
}
});

class Filters extends Component {

Expand All @@ -41,10 +28,6 @@ class Filters extends Component {
};
}

static propTypes = {
classes: PropTypes.object.isRequired
};

handleChange(event) {
if(this.props.firstSearch) this.props.handleFirstSearch();
const { name, value } = event.target;
Expand All @@ -53,7 +36,7 @@ class Filters extends Component {

render() {

const { classes, isEnglish } = this.props;
const { isEnglish } = this.props;

return (
<div>
Expand All @@ -67,7 +50,7 @@ class Filters extends Component {
borderColor="grey.300"
borderRadius="borderRadius"
>
<FormControl fullWidth className={classes.keywords}>
<FormControl fullWidth className="keyword-input">
<TextField
name="keyword"
value={this.state.keyword}
Expand All @@ -89,9 +72,8 @@ class Filters extends Component {
borderRadius="borderRadius"
>

<FormControl
style={isWidthUp('sm', this.props.width) ? {} : { width: "calc(100% - 16px)"}}
className={classes.root}
<FormControl
className="filter-selects"
>
<InputLabel>{isEnglish ? "Category" : "Categoría"}</InputLabel>
<Select
Expand All @@ -113,9 +95,8 @@ class Filters extends Component {
</Select>
</FormControl>

<FormControl
style={isWidthUp('sm', this.props.width) ? {} : { width: "calc(100% - 16px)"}}
className={classes.root}
<FormControl
className="filter-selects"
>
<InputLabel>{isEnglish ? "Area" : "Área"}</InputLabel>
<Select
Expand All @@ -134,9 +115,8 @@ class Filters extends Component {
</Select>
</FormControl>

<FormControl
style={isWidthUp('sm', this.props.width) ? {} : { width: "calc(100% - 16px)"}}
className={classes.root}
<FormControl
className="filter-selects"
>
<InputLabel>{isEnglish ? "Environment" : "Ambiente"}</InputLabel>
<Select
Expand All @@ -158,7 +138,7 @@ class Filters extends Component {
</FormControl>

<Hidden smDown>
<FormControl className={classes.root}>
<FormControl className="filter-selects">
<InputLabel>{isEnglish ? "Sort by" : "Ordenar por"}</InputLabel>
<Select
name="sortField"
Expand Down Expand Up @@ -190,4 +170,4 @@ class Filters extends Component {
}
}

export default withWidth()(withStyles(styles)(Filters));
export default withWidth()(Filters);
2 changes: 1 addition & 1 deletion client/src/components/RestaurantList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function RestaurantList(props) {
} else {
if(restaurants.length > 0) {
grid = (
<GridList cols={getGridListCols()} style={{maxWidth: "100vw"}}>
<GridList cols={getGridListCols()}>
{restaurants.map(rest => (
<GridListTile
title={rest.name}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"start": "node server/index.js",
"heroku-postbuild": "cd server && npm install && cd ../client && npm install && npm run build"
},
"engines": {
"node": "12.14.1"
},
"keywords": [],
"author": "",
"license": "ISC"
Expand Down
2 changes: 1 addition & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ app.use(express.urlencoded({ extended: true }));

if(process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, '../client/build')));
app.get('*', (req, res) => {
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, '../client/build/index.html'));
});
}
Expand Down

0 comments on commit 2ab767c

Please sign in to comment.