npm package: @hollar/hollar-global-navbar
Description: Shareable global navigation menu
Latest version: 3.1.3

# global-navbar

## For hollar-web

steps to publish:

1. run command `npm run build`
2. change `version` in `package.json`
3. run command `npm publish`

## For hollar

steps to publish:

1. run command `npm run build:rails`
2. copy `index.js` to `navbar.js`

## Update version rules
For each task, you need to work on fixing the bug or feature, please put .alpha.ticketnumber.version and publish it.

For example, if you work on the task 12345 clubhouse ticket that requires update global-nav npm. Let say the current version of global nav is `2.0.1` Your PR will contain update version of npm is as `2.0.2.alpha.12345.1` and publish it.

If it doesn't pass QA, the next commit will be `2.0.2.alpha.12345.2` and so on...until it passes QA.

When merging to production, the version will be updated to the latest and remove suffix `.alpha` out.

## version convention
Each number has different meaning.

version A.B.C

A = big milestone // Ex. when we launch new global nav

B = new feature // When we add new feature, we should update this number

C = fix buges

.alpha = for testing purpose. You are about 70%-80% sure that it will be bug free. If you have less than 70% sure, you should test on your local first.

.beta = normally, this is for big milestone when you want to pass it to QA for testing.

## How to build the global-nav files for hollar-web and hollar 

Before you start adding changes please signup for an npmjs.com account and request access to @hollar/hollar-global-navbar (https://www.npmjs.com/package/@hollar/hollar-global-navbar). Once you begin following @hollar/hollar-global-navbar you’ll be able to push updated package version to the global-navbar

## Building the global-navbar
Once you’re done making your updates to in the global-nav repo run the following commands in the CLI. The documentation can also be found here https://www.npmjs.com/package/@hollar/hollar-global-navbar under the Readme section.
1. `run command npm run build`
2. change version in package.json
3. `run command npm publish`

For package naming convention please use the current package version + your story number. For example “2.4.0-ewa-1234”. Please refer to the version section on the global-nav npm page.

## Installation of navbar for hollar-web 
Next got to the hollar-web repo and update the version of the hollar/hollar-global-navbar in the `package.json` file and the run `npm install` in the hollar-web CLI. Once that’s done restart the hollar-web server. Refresh the page and check for your updates.

## Installation for hollar (rails)
In the global-nav repo CLI run the following command
`run command npm run build:rails`
In the root folder of the global-nav directory there should be and `index.js` file (global-nav/index.js) 

Copy everything in that file beginning after  
`(function (React, ReactDOM, injectSheet, classnames) {
  'use strict’;`

To right before 
`ReactDOM__default.render(React__default.createElement(Navbar, null), document.querySelector('#navbar-root’));`

Then go to the hollar repo and go to `hollar/app/assets/javascripts/spree/frontend/navbar/navbar-template.js.erb`

Around line 159 there should be a comment block. Paste your code over the entire comment block. Do not save!

Then copy all the code in `navbar-template.js.erb` and paste the entire code into hollar/app/assets/javascripts/spree/frontend/navbar/navbar.js.erb and save. 

Once this is done restart the rails server and go to a static page, for example `/about` and check for your updates.