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

Boycott modal #13

Merged
merged 5 commits into from Aug 4, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"bulma": "^0.7.1",
"google-maps-react": "^2.0.2",
"react": "^16.3.2",
"react-dom": "^16.3.2",
Expand Down
4 changes: 4 additions & 0 deletions src/App.css
Expand Up @@ -26,3 +26,7 @@
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

.map-container {
height: 65vh;
}
26 changes: 24 additions & 2 deletions src/components/App.js
Expand Up @@ -2,29 +2,51 @@ import React, { Component } from "react";

import GoogleMapsComponent from "./MapContainer";
import Button from "./Button";
import BoycottModal from "./BoycottModal";
import logo from "../logo.svg";
import "../App.css";
import 'bulma/css/bulma.css'

class App extends Component {
constructor(props) {
super(props);

this.state = {
isActive: false
};

this.toggleModal = this.toggleModal.bind(this);
}

componentDidMount() {
// this is here as an example for how to connect to the backend
// it should be removed once development has started
// this.props.healthCheck();
}

toggleModal = () => {
this.setState({
isActive: !this.state.isActive
});
}

render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to Boycottr</h1>
</header>
<Button buttonText="Add Boycott" onClickHandler={this.toggleModal}/>
<BoycottModal
isActive={this.state.isActive}
onClose={this.toggleModal}
/>
<div className="App-intro">
<div className="map-container">
<GoogleMapsComponent
className="map"
/>
<Button buttonText="Add Boycott"/>
/>
</div>
</div>
</div>
Expand Down
31 changes: 31 additions & 0 deletions src/components/BoycottModal.js
@@ -0,0 +1,31 @@
import React, { Component } from 'react';

export class BoycottModal extends Component {
render() {
//Render nothing if the "show" prop is false
if(!this.props.isActive) {
return null;
}

return (
<div className={this.props.isActive ? 'is-active modal' : 'modal'} >
<div className="modal-background"></div>
<div className="modal-card">
<header className="modal-card-head">
<button
className="delete"
aria-label="close"
onClick={this.props.onClose}
></button>
</header>
<section className="modal-card-body">
</section>
<footer className="modal-card-foot">
</footer>
</div>
</div>
);
}
}

export default BoycottModal;
12 changes: 10 additions & 2 deletions src/components/MapContainer.js
Expand Up @@ -55,19 +55,27 @@ export class GoogleMapsComponent extends Component {

render() {
const { isLoading, userLat, userLng } = this.props;
const style = {
'width': '85%',
'margin': '0 auto',
'display': 'block',
'height' : '65vh',
'position': 'static'
}

return (
isLoading
? <p>Loading</p>
: <Map
google = {this.props.google}
className = "map"
zoom = {10}
zoom = {14}
initialCenter = {
{
lat: userLat,
lng: userLng
}
}
style = {style}
>
{MarkerList({markerData: this.props.markerData})}
</Map>
Expand Down