Skip to content

Commit

Permalink
Add setup step
Browse files Browse the repository at this point in the history
  • Loading branch information
abmai committed Aug 16, 2017
1 parent 7a90cf6 commit 551cc53
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/demos/starting-with-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Checkout the complete code for this step

## 1. Start with a bare React Component

Checkout the starting code here
[here](https://github.com/uber-common/vis-tutorial/tree/master/demos/starting-code).
**HOLD UP!!!** If you got here without reading the **Setup** step, it is
highly recommended that you do so, or your application might not work.
[GO HERE](/#/setup) and go through it now.

The app component in the starting code above currently looks like this:
```js
Expand Down
50 changes: 50 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Before we go through the tutorial, let's make sure we have everything necessary
in order to make this as smooth as possible.

## 1. Getting a Mapbox Token

You need a free Mapbox token in order to get the map to load.
Head over to [Mapbox](https://www.mapbox.com/help/define-access-token/) and get
one now.

Once you have it, set the token in your environment (whichever terminal you will
use to run the tutorial from).
```
export MapboxAccessToken=<token>
```

## 2. Cloning and Running Starting Code

In order to do live coding, you can use the example starting code we provide.
Clone our tutorial repository and go through the usual setup steps. NOTE: you
need to be running node **>=v6** locally.
```
git clone https://github.com/uber-common/vis-tutorial.git
...
cd vis-tutorial
npm install OR yarn
...
npm run start
```

A page should automatically be opened in your browser, which looks very similar
to the page you see now.

**But with a caveat**

There should now be a new link called **Live Code Playground** right after
**Welcome!**. This is rendering our starting code, which we will build into
a nice visualization app as the tutorial progresses. Every change you make will
be rendered on this page (assuming you keep the local node instance running).

## 3. Open Starting Code in your Text Editor

You can now point your text editor to the following file:

```
vis-tutorial/demos/starting-code/app.js
```

It's an empty component! `starting-code` will be the folder that holds all your
changes as you go through the tutorial. You can now head to the next step:
[Starting With A Map](/#/react-map/starting-with-map).
4 changes: 4 additions & 0 deletions src/constants/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export const docPages = generatePath([
env: 'development',
content: getDocUrl('demos/live-code.md')
},
{
name: 'Setup - READ ME FIRST',
content: getDocUrl('setup.md')
},
{
name: 'React Map GL',
children: [
Expand Down

0 comments on commit 551cc53

Please sign in to comment.