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

Add menu bar buttons #4

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 3 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React from 'react'
import Map from './Map'
import Taskbar from './Taskbar'

function App() {
return (
<div className="App">
<header className="App-header">
<Map //eslint-disable-next-line
style="mapbox://styles/mapbox/light-v9"
containerStyle={{
height: '100vh',
width: '100vw',
}}
zoom={[6.5]}
center={[-123.35, 48.41]}
/>
<Taskbar />
<Map />
</header>
</div>
)
Expand Down
24 changes: 22 additions & 2 deletions src/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
// import React from 'react';
import React from 'react'
import ReactMapboxGL from 'react-mapbox-gl'
import { ZoomControl } from 'react-mapbox-gl'

const Map = ReactMapboxGL({
const ReactMap = ReactMapboxGL({
// accessToken:
accessToken:
'pk.eyJ1Ijoic3RvcmNrcGhvdG9zIiwiYSI6ImNrODNvYmc0czAxazMzbW1yZDdyeWZoNjAifQ.PiAIkQrVS4a5c7dBgcElhQ',
})

class Map extends React.Component {
render() {
return (
<div>
<ZoomControl />
<ReactMap
style="mapbox://styles/mapbox/light-v9"
containerStyle={{
height: '100vh',
width: '100vw',
}}
zoom={[6.5]}
center={[-123.35, 48.41]}
/>
</div>
)
}
}

export default Map
36 changes: 36 additions & 0 deletions src/Taskbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react'

class Taskbar extends React.Component {
clearMarkers() {
Copy link
Collaborator

@aloksingh3112 aloksingh3112 Mar 26, 2020

Choose a reason for hiding this comment

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

make this an arrow function as with onClick the "this" property changes this code doesn't throws any error for now but we will definitely be using the this property in these functions.

console.log('clearing markers')
}
addRaw() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here make it a arrow function.

console.log('Adding raw observations')
}
pull() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

make it a arrow function.

console.log('Pulling from google sheets')
}
refresh() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

make it a arrow function.

console.log('Refreshing markers')
}
openSheet() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

make it a arrow function.

console.log('Opening google sheeet')
}
render() {
return (
<div className="menubar">
<button onClick={this.clearMarkers}>Clear new markers</button>
<br />
<button onClick={this.addRaw}>Add raw observations</button>
<br />
<button onClick={this.pull}>Pull from Google sheets</button>
<br />
<button onClick={this.refresh}>Refresh Markers</button>
<br />
<button onClick={this.openSheet}>Open Google sheets</button>
</div>
)
}
}

export default Taskbar
16 changes: 16 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

.menubar{
position: fixed;
z-index: 10;
top: 10px;
left: 10px;
padding: 10px;
border-radius: 5px;
background: rgba(0,0,0,0.6);
}

.menubar > button{
font-size: 14px;
padding: 3px;
margin-bottom: 5px;
}