# n-myft-ui myft

Client-side module to handle display of generic myft ui e.g. add to myft buttons

## Consuming

* Include JS and SCSS
* Templates are provided for the following:

### Following

	{{> n-myft-ui/components/follow-button/follow-button}}

The templates require a _conceptId_ variable. You can also override the button text by providing a _buttonText_ property.

You can require different variants of the button as below:
	{{> n-myft-ui/components/follow-button/follow-button variant='primary'}}
	{{> n-myft-ui/components/follow-button/follow-button variant='inverse'}}

### Save for later

	{{>n-ui/myft/components/save-for-later/save-for-later contentId=id}}
	{{>n-ui/myft/components/save-for-later/save-for-later contentId=id isSaved=true}}

The templates require an _contentId_ variable. You can also override the button text by providing a _buttonText_ property.
There is a different styling available. To apply the styling, provide _saveButtonWithIcon_ property and set it `true`. Check the styling on demos.

If `isSaved=true` is specified then the button will start in the *saved* state, i.e. it will be an *unsave* button.

## JS API

- `init()` Sets up listeners to update all myft buttons (follow, save, preference) to match the user's preferences
- `updateUi(el)` Update the ui within a given element to match the user's preferences. If `el` is undefined applies to the whole page

## Releasing

This is an NPM module, to release update the git tag.

## Testing

Run `make test` to run Karma/Mocha tests.
