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

Desktop Header Component #9

Merged
merged 7 commits into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
151 changes: 141 additions & 10 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.App {
text-align: center;
display: flex;
flex-direction: column;
height: 100vh;
}

.Main {
background-color: lightgray;
padding-bottom: 120px;
}

/*
Expand Down Expand Up @@ -53,18 +61,96 @@ Header
display: table-cell;
vertical-align: middle;
font-weight: bold;
color: white;
}

.filterButton {
height: 70px;
float: right;
display: table-cell;
}

.filterButton > span {
margin-right: 15px;
}

.toolbar {
display: table !important;
background-color: white;
height: 70px;
}

/*
Desktop Header
*/
.categories {
display: inline-block;
text-transform: uppercase;
color: black;
height: 37px !important;

}

.categories > h4 {
margin: 10px 5px;
font-size: 12px;
cursor: pointer;
}

.nav {
display: inline-block;
float: right;
}

.appBar {
background-color: black !important;
display: table !important;
}

#explore {
background-color: #8acc25;
}

#report {
background-color: #ffd700;
}

#resources {
background-color: #39c9bb;
}

.headerTitle {
display: inline;
font-size: 14px;
color: white;
position: absolute;
left: 27%;
}

@media (min-width: 768px) {
.headerTitle {
left: 26%;
}
}

@media (min-width: 1024px) {
.headerTitle {
left: 23%;
}
}

@media (min-width: 1280px) {
.headerTitle {
left: 20%;
}
}

.logo {
Copy link
Contributor

Choose a reason for hiding this comment

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

One mega-mega-mega nit is that I don't think this logo has a drop-shadow like the rest of the header does. IDK how tricky that is to make happen -- maybe something for the backlog?

Copy link
Contributor Author

@savannahostrowski savannahostrowski Apr 11, 2019

Choose a reason for hiding this comment

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

Just added a v. small box shadow for now on 3 sides...not perfect because it overlaps the black bar but I'm not 100% sure that we can do this partially with CSS. Alternatively, I can remove the shadow from the black bar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, we need a better asset for the logo - this is a screenshot 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also might want to throw an onClick event on the logo to nav back to home eventually but that's tbd.

height: 120px;
width: 120px;
background: url('assets/logo.png') no-repeat;
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

background-size: contain;
position: absolute;
left: 10%;
box-shadow: 1px 1px 1px grey;
}

/*
Expand Down Expand Up @@ -129,23 +215,72 @@ input {
background-color: transparent;
}

/*
List + Card
*/

.cardContainer {
margin-top: 30px;
margin-bottom: 80px;
display: flex;
align-items: center;
flex-direction: column;
height: 100%;
justify-content: center;
}


.card {
margin: 16px;
height: 150px;
width: 400px;
}

.cardPicture {
height: 150px;
width: 150px;
}

@media (min-width: 600px) {
.card {
width: 550px;
}
}

@media (min-width: 768px) {

.cardContainer {
margin-top: 80px;
margin-bottom: 0;
}

.card {
width: 650px;
height: 200px;
}

.cardPicture {
height: 200px;
width: 200px;
}
}

/*
Footer Styles
*/

.plusButton {
position: relative;
top: -40px;
top: -50px;
}

.footerIconDiv {
width: 100%;
position: sticky;
bottom: 0;
left: 0;
padding-bottom: 25px;
padding: 25px 0;
background-color: white;
position: sticky;
}

.footerIcons span {
Expand All @@ -158,8 +293,4 @@ Footer Styles
color: gray;
}

.App {
display: flex;
flex-direction: column;
height: 100vh;
}

7 changes: 4 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';

import Header from './components/Header';
import DesktopHeader from "./components/DesktopHeader";
import Header from './components/MobileHeader';
import Footer from './components/Footer';
import Main from './components/Main';

Expand All @@ -22,14 +23,14 @@ class App extends Component {
}

checkIfMobile = () => {
this.setState({ isMobile: window.innerWidth < 600 });
this.setState({ isMobile: window.innerWidth < 768 });
};

render() {
const { isMobile } = this.state;
return (
<div className="App">
{isMobile ? <Header/> : null}
{isMobile ? <Header/> : <DesktopHeader/>}
<Main/>
{isMobile ? <Footer/> : null}
</div>
Expand Down
Binary file added src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions src/components/DesktopHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';

import withStyles from '@material-ui/core/styles/withStyles';
import AppBar from '@material-ui/core/AppBar';
import Button from '@material-ui/core/Button';
import List from '@material-ui/core/List/List';
import ListItem from '@material-ui/core/ListItem/ListItem';
import Menu from '@material-ui/icons/Menu';
import SwipeableDrawer from '@material-ui/core/SwipeableDrawer/SwipeableDrawer';

import '../App.css';


const styles = {
moreIcon: {
float: 'right',
display: 'inline',
color: 'white',
paddingBottom: 0,
},

};

class DesktopHeader extends Component {
state = {
right: false,
};

toggleDrawer = (side, open) => () => {
this.setState({
[side]: open,
});
};

render() {
const { classes, history } = this.props;

return (
<div style={{ position: 'fixed', width: '100%' }}>
<AppBar position="static" className="appBar">
<div className="logo"/>
<h1 className="headerTitle" onClick={() => history.push('/')} style={{ cursor: 'pointer' }}>
Urban Carnivore Sightings
</h1>
<Button className={classes.moreIcon} onClick={this.toggleDrawer('right', true)}><Menu/></Button>
<SwipeableDrawer
anchor="right"
open={this.state.right}
onClose={this.toggleDrawer('right', false)}
onOpen={this.toggleDrawer('right', true)}
>
<div
tabIndex={0}
role="button"
onClick={this.toggleDrawer('right', false)}
onKeyDown={this.toggleDrawer('right', false)}
style={{ width: '250px' }}
>
<List>
<ListItem className="drawerItem"><h3>Stub</h3>
</ListItem>
<ListItem className="drawerItem"><h3>Stub</h3>
</ListItem>
<ListItem className="drawerItem"><h3>Stub</h3>
</ListItem>
</List>
</div>
</SwipeableDrawer>
<div className="nav">
<div id="explore" className="categories" onClick={() => history.push('/map')}><h4>Explore</h4></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

<div id="resources" className="categories" onClick={() => history.push('/resources')}><h4>Resources</h4>
</div>
<div id="report" className="categories" onClick={() => history.push('/reports/create')}><h4>Report
Sightings</h4></div>
</div>

</AppBar>
</div>
);
}
}

DesktopHeader.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withRouter(withStyles(styles)(DesktopHeader));
23 changes: 5 additions & 18 deletions src/components/ListCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,12 @@ import { withStyles } from '@material-ui/core/styles';
const DEFAULT_IMAGE_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/2010-brown-bear.jpg/200px-2010-brown-bear.jpg";

const styles = theme => ({
picture: {
width: 150,
height: 150
},
info: {
flexDirection: 'column',
flexGrow: 1,
flex: 1,
textAlign: 'left'
},
card: {
marginBottom: 16,
marginLeft: 16,
marginRight: 16,
marginTop: 16,
height: 150,
maxWidth: 500,
minWidth: 500
},
allContent: {
display: 'flex',
padding: 0
Expand Down Expand Up @@ -56,22 +43,22 @@ const locationToString = location => {
return "No location provided";
}
if (location._longitude && location._latitude) {
return `${location._longitude} ${location._longitude}`;
return `${location._longitude.toFixed(6)}, ${location._longitude.toFixed(6)}`;
}
return location.toString();
}

const ListCard = props => {
const { classes, data } = props;
return <Card className={classes.card}>
return <Card className="card">
<CardContent className={classes.allContent}>
<CardMedia className={classes.picture}
image={data.image_url ? data.image_url : DEFAULT_IMAGE_URL}
<CardMedia className="cardPicture"
image={data.image_url ? data.image_url : DEFAULT_IMAGE_URL}
/>
<CardContent className={classes.info}>
<Typography variant={'h3'}>{data.species.toUpperCase()}</Typography>
<Typography variant={'subtitle1'}>{timeToString(data.time_seen)}</Typography>
<Typography variant={'subtitle1'}>{locationToString(data.location)}</Typography>
<Typography style={{ color: 'grey' }}>{locationToString(data.location)}</Typography>
</CardContent>
</CardContent>
</Card>
Expand Down
Loading