-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from UnicornGlobal/dev
v1.1.0
- Loading branch information
Showing
22 changed files
with
12,893 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"env": { | ||
"development": { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"modules": false | ||
} | ||
] | ||
] | ||
}, | ||
"test": { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"modules": false, | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"istanbul" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/build/ | ||
/config/ | ||
/dist/ | ||
/*.js | ||
/test/unit/coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// https://eslint.org/docs/user-guide/configuring | ||
|
||
module.exports = { | ||
root: true, | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
env: { | ||
browser: true, | ||
}, | ||
// https://github.com/standard/standard/blob/master/docs/RULES-en.md | ||
extends: 'standard', | ||
// required to lint *.vue files | ||
plugins: [ | ||
'html' | ||
], | ||
'settings': { | ||
'html/html-extensions': ['.html', '.vue'] | ||
}, | ||
// add your custom rules here | ||
'rules': { | ||
'no-trailing-spaces': 1, | ||
'space-before-function-paren': 1, | ||
'space-before-blocks': 1, | ||
'keyword-spacing': 1, | ||
// allow paren-less arrow functions | ||
'arrow-parens': 0, | ||
// allow async-await | ||
'generator-star-spacing': 0, | ||
// allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.DS_Store | ||
node_modules/ | ||
dist/ | ||
npm-debug.log | ||
yarn-error.log | ||
.tmp | ||
.nyc_output | ||
coverage | ||
|
||
# Editor directories and files | ||
.idea | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw[po] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
dist: trusty | ||
language: node_js | ||
node_js: | ||
- 9 | ||
before_install: | ||
- npm install | ||
- npm test | ||
after_success: | ||
- codecov coverage/lcov.info -t ${CODECOV_TOKEN} | ||
- echo 'Done!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Unicorn Global et al | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,110 @@ | ||
# vue-toaster | ||
Toaster that makes Toast | ||
|
||
[![Build Status](https://travis-ci.com/darrynten/vue-toaster.svg?token=2azvxgpyzAkLb1UEKNft&branch=dev)](https://travis-ci.com/darrynten/vue-toaster) | ||
[![codecov](https://codecov.io/gh/darrynten/vue-toaster/branch/dev/graph/badge.svg?token=gkxihPWHlk)](https://codecov.io/gh/darrynten/vue-toaster) | ||
|
||
> A toaster that makes toast | ||
## Installation | ||
|
||
``` | ||
npm install --save vue-toaster | ||
``` | ||
|
||
## Setup | ||
|
||
In your `main.js` file, | ||
|
||
``` | ||
import { ToasterEvents } from 'vue-toaster' | ||
``` | ||
|
||
Add the toaster events to your vue instance as shown below: | ||
|
||
``` | ||
Vue.prototype.$toaster = ToasterEvents | ||
``` | ||
## Usage | ||
|
||
Import the `Toaster` component in your App.vue and configure it using the example below | ||
|
||
`App.vue` | ||
|
||
``` | ||
<template> | ||
<div id="app"> | ||
<toaster></toaster> | ||
<div><img src="./assets/logo.png"></div> | ||
<HelloWorld/> | ||
</div> | ||
</template> | ||
<script> | ||
import HelloWorld from './components/HelloWorld' | ||
import { Toaster } from 'vue-toaster | ||
export default { | ||
name: 'App', | ||
components: { | ||
Toaster, | ||
HelloWorld | ||
} | ||
} | ||
</script> | ||
``` | ||
|
||
### Basic | ||
|
||
The Toaster can be called anywhere in your app by doing `this.$toaster.addToast(options)`. | ||
Here is an example. | ||
|
||
`Test.vue` | ||
|
||
``` | ||
<script> | ||
export default { | ||
name: 'Test', | ||
methods: { | ||
submit() { | ||
if (!this.name) { | ||
this.$toaster.addToast({ | ||
type: 'error', | ||
title: 'Invalid Name', | ||
message: 'Please add a name' | ||
}) | ||
return | ||
} | ||
... | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
|
||
This will display an error toast with the message to the user. | ||
|
||
### Advanced | ||
|
||
You can configure the timeout of the toast by adding a `timeOut` property | ||
E.g. | ||
|
||
``` | ||
this.$toaster.addToast({ | ||
type: 'info', | ||
title: 'Secret Key', | ||
message: 'Please configure your secret key in the security section of the dashboard.', | ||
timeOut: 5000 | ||
}) | ||
``` | ||
|
||
## Details | ||
|
||
It displays a toast depending on the type specified in the toast options. It makes use of an `EventEmitter` behind the scene and it emits an event whenever the `addToast` method is called. The toast is then added to an array of toasts; gets displayed on the screen and removed from the araay after the timeout. The default `timeOut` of a toast is `3500` (3.5s) and it can be configure to be higher or lower. | ||
|
||
# Roadmap | ||
|
||
- [ ] - Enable users to configure toast colors | ||
|
||
# Contributors | ||
|
||
[Bamidele Daniel](https://github.com/humanityjs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Toaster from './src/Toaster.vue' | ||
import ToasterEvents from './src/ToasterEvents.js' | ||
export { | ||
Toaster, | ||
ToasterEvents | ||
} |
Oops, something went wrong.