Skip to content

Commit

Permalink
Merge pull request #3 from elite-grub/boxtext
Browse files Browse the repository at this point in the history
Implement MVP for Map Modal view
  • Loading branch information
YesImKenny authored Mar 2, 2019
2 parents 95747da + 3ad95da commit 12acccc
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 83 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file modified client/.DS_Store
Binary file not shown.
Binary file added client/components/.DS_Store
Binary file not shown.
53 changes: 47 additions & 6 deletions client/components/App.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,61 @@
import React from 'react';
import Container from './Container';
import axios from 'axios';
import MapBox from './MapBox';
import MapText from './MapText';
import MapModal from './MapModal';
import { Border, Font } from './style.js';

class App extends React.Component {
constructor(props) {
super(props);
this.state = {

data: [],
getRandomInt: function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max) + 1);
},
toggleMap: 'none',
};
this.handleClick = this.handleClick.bind(this);
this.closeClick = this.closeClick.bind(this);
}

componentDidMount() {
this.getRestaurant();
}

getRestaurant() {
axios.get(`/restaurant/${this.state.getRandomInt(100)}`)
.then((res) => {
const restaurant = res.data[0];
console.log('got data to CLient!!', restaurant);
this.setState({ data: restaurant });
})
.catch(err => err);
}

handleClick() {
this.setState(state => ({
toggleMap: 'block',
}));
console.log('The link was clicked from APP!!!');
}

closeClick() {
this.setState(state => ({
toggleMap: 'none',
}));
console.log('Close Button clicked in Modal View');
}

render() {
return (
<div>
<h1>Hello from App!</h1>
<Container />
</div>
<Font>
<Border className="container">
<MapBox handleClick={this.handleClick} />
<MapText data={this.state.data} handleClick={this.handleClick} />
<MapModal toggleMap={this.state.toggleMap} closeClick={this.closeClick} />
</Border>
</Font>
);
}
}
Expand Down
24 changes: 0 additions & 24 deletions client/components/Container.jsx

This file was deleted.

4 changes: 3 additions & 1 deletion client/components/MapBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class MapBox extends React.Component {
render() {
return (
<div>
<h1>Hello from MapBox!</h1>
<a onClick={this.props.handleClick}>
<img src="https://s3-us-west-1.amazonaws.com/placeholders-kt/mapSample.png" alt="Map Placeholder" height="135" width="286" />
</a>
</div>
);
}
Expand Down
32 changes: 32 additions & 0 deletions client/components/MapModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import { ModalStyle, CloseStyle } from './style.js';

class MapModal extends React.Component {
constructor(props) {
super(props);
this.state = {

};
}

render() {
return (

<ModalStyle style={{ display: this.props.toggleMap }}>
<div id="myModal" className="modal">

<CloseStyle className="close">
<a onClick={this.props.closeClick}>
Close &times;
</a>
</CloseStyle>
<div className="modal-content">
<img src="https://s3-us-west-1.amazonaws.com/placeholders-kt/mapModal.png" alt="Map Placeholder" height="100%" width="100%" />
</div>
</div>
</ModalStyle>
);
}
}

export default MapModal;
60 changes: 41 additions & 19 deletions client/components/MapText.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
GetDirections, GetLocation, GetPhone, GetLink, GetCalendar, GetIphone, BlueLinks,
} from './style.js';

class MapText extends React.Component {
constructor(props) {
Expand All @@ -9,27 +13,45 @@ class MapText extends React.Component {
}

render() {
const {
street, cityStateZip, phone, website,
} = this.props.data;

// const { } = this.props.handleClick;

return (
<div className="map-text">
<h1>Hello from MapText!</h1>
<ul>
<li>
Pier 39
<br />
Ste A-202
<br />
San Francisco, CA 94133
<br />
Fisherman's Wharf, North
<br />
Beach/Telegraph Hill
</li>
<li>Get Directions</li>
<li>(415) 421-2442</li>
<li>fogharbor.com</li>
<li>Make a Reservation</li>
<li>Send to your Phone</li>
</ul>

<GetLocation size="18" />
<b>{street}</b>
<br />
<b>{cityStateZip}</b>
<br />

<BlueLinks>
<GetDirections size="18" />
<a onClick={this.props.handleClick}>Get Directions</a>
</BlueLinks>

<GetPhone size="18" />
{phone}
<br />

<BlueLinks>
<GetLink size="18" />
{website}
</BlueLinks>

<BlueLinks>
<GetCalendar size="18" />
Make a Reservation
</BlueLinks>

<BlueLinks>
<GetIphone size="18" />
Send to your Phone
</BlueLinks>

</div>
);
}
Expand Down
75 changes: 75 additions & 0 deletions client/components/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import styled from 'styled-components';
import { Directions } from 'styled-icons/material/Directions';
import { LocationOn } from 'styled-icons/material/LocationOn';
import { Phone } from 'styled-icons/material/Phone';
import { LinkExternal } from 'styled-icons/boxicons-regular/LinkExternal';
import { CalendarEvent } from 'styled-icons/boxicons-regular/CalendarEvent';
import { PhoneIphone } from 'styled-icons/material/PhoneIphone';
import { Edit } from 'styled-icons/material/Edit';

// ICON STYLES
export const GetDirections = styled(Directions)`
color: grey;
`;

export const GetLocation = styled(LocationOn)`
color: grey;
`;

export const GetPhone = styled(Phone)`
color: grey;
`;

export const GetLink = styled(LinkExternal)`
color: grey;
`;

export const GetCalendar = styled(CalendarEvent)`
color: grey;
`;

export const GetIphone = styled(PhoneIphone)`
color: grey;
`;

export const GetEdit = styled(Edit)`
color: grey;
`;

export const Border = styled.div`
padding: 5px;
background: #fff;
border: 1px solid #ccc;
width: 300px;
height: 353px;
`;

export const BlueLinks = styled.div`
color: #0073bb;
`;

export const Font = styled.div`
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

`;

/* The Modal (background) */
export const ModalStyle = styled.div`
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: none;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.8);
`;

/* The Close Button */
export const CloseStyle = styled.div`
color: white;
font-size: 15px;
font-weight: normal;
padding: .05px;
`;
25 changes: 20 additions & 5 deletions client/dist/bundle.js

Large diffs are not rendered by default.

Loading

0 comments on commit 12acccc

Please sign in to comment.