Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/shakee93/vue-toasted
Browse files Browse the repository at this point in the history
# Conflicts:
#	.idea/workspace.xml
  • Loading branch information
shakee93 committed Mar 16, 2017
2 parents e4f551a + a3feb80 commit 9cb93be
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 8,792 deletions.
2 changes: 1 addition & 1 deletion .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

489 changes: 34 additions & 455 deletions .idea/workspace.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ src/
.babelrc
webpack.config.js
README.md
*.map
*.map
examples
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Shakeeb Sadikeen

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.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
</a>
</p>

[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/vuejs/awesome-vue)
## Introduction

vue-toasted is a cool material toast plugin with variety of options and styles. it is touch compatible and responsive.
issues and pr's are always welcome

Checkout the <a target="_blank" href="https://shakee93.github.io/vue-toasted/"> Interactive Demo </a> here.

## Usage

It is simple. couple of lines all what you need.
Expand Down Expand Up @@ -43,7 +46,7 @@ All Good Now you have this cool toast in your project.. let's take a look at the
vue-toasted has methods which makes it much easier to use

### methods

all the below methods return the `Toasted Object` of the toast.
```javascript
Vue.toasted.success( {string | html } message, {object} options)

Expand All @@ -54,16 +57,31 @@ Vue.toasted.info(message, options)
Vue.toasted.error(message, options)
```

####Toast Object
check the examples to see how to manipulate the object.
```javascript

// html element of the toast
el : HtmlElement

// change text or html of the toast
text : Function(text)

// fadeAway the toast. default delay will be 800ms
goAway : Function(delay = 800)

```

### options

below are the available options

| Option | Description | Values | Default |
|-----------|------------------------------------------------|-------------------------|----------|
| position | location of the toast | 'top-right', 'top-left', 'bottom-right', 'bottom-left' | 'top-right' |
| position | position of the toast container | 'top-right', 'top-center', 'top-left', 'bottom-right', 'bottom-center', 'bottom-left' | 'top-right' |
| duration | display time of the toast | in millisecond | null |
| className | custom css class name of the toast | | null |
| type | style of the toast you prefer | 'primary', 'outline', 'bubble' | 'primary' |
| theme | theme of the toast you prefer | 'primary', 'outline', 'bubble' | 'primary' |
| onComplete | class name of the optional icon font | a callback function | null |

Enjoy Toasting !!
8,148 changes: 3 additions & 8,145 deletions dist/vue-toasted.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions examples/toast-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Vue from 'vue';
import VueToasted from 'vue-toasted';

Vue.use(VueToasted);

let toast = Vue.toasted.show('hello there, i am a toast !!');

// now you can use the toast object methods
toast
// change the text
.text("change me now")

// fade away in 1.5 seconds
.goAway(1500);
19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
{
"name": "vue-toasted",
"description": "Cool Toast plugin for vue",
"version": "1.0.14",
"version": "1.0.21",
"author": "Shakeeb Sadikeen <shakee.zats@gmail.com>",
"repository": {
"type": "git",
"url": "https://github.com/shakee93/vue-toasted.git"
},
"main": "./dist/vue-toasted.min.js",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"build-local-watch": "cross-env NODE_ENV=production webpack --progress --hide-modules --watch",
"watch": "webpack --progress --hide-modules --watch",
"prebuild": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"es": "babel src --presets babel-preset-es2015 --out-dir dist"
},
"keywords": [
"toast",
"vue",
"vue-toasted",
"responsive",
"touch-compatible",
"touch",
"vue-toast"
],
"dependencies": {
"hammerjs": "^2.0.8",
"sass-loader": "^6.0.3",
"velocity-animate": "^1.4.3"
},
"devDependencies": {
Expand All @@ -24,6 +39,8 @@
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"node-sass": "^4.5.0",
"sass-loader": "^6.0.3",
"vue-loader": "^11.0.0",
"vue-template-compiler": "^2.2.1",
"webpack": "^2.2.0",
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { initPlugin } from './toast';

export default {
const Toasted = {
install: (Vue, options) => {
initPlugin(Vue, options)
}
};

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(Toasted);
}

export default Toasted
183 changes: 183 additions & 0 deletions src/sass/toast.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#toasted-container {
display: block;
position: fixed;
z-index: 10000;

.toasted {
top: 35px;
width: auto;
clear: both;
margin-top: 10px;
position: relative;
max-width: 100%;
height: auto;
word-break: break-all;
display: flex;
align-items: center;
justify-content: space-between;

.btn, .btn-flat {
margin: 0;
margin-left: 3rem;
}

// Templates

&.rounded {
border-radius: 24px;
}

// Primary
&.primary {
border-radius: 2px;
min-height: 38px;
line-height: 1.1em;
background-color: #353535;
padding: 0 20px;
font-size: 15px;
font-weight: 300;
color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);

&.success {
background: #4CAF50;
}

&.error {
background: #F44336;
}

&.info {
background: #3F51B5;
}

}

// Bubble
&.bubble {
border-radius: 30px;
min-height: 38px;
line-height: 1.1em;
background-color: #FF7043;
padding: 0 20px;
font-size: 15px;
font-weight: 300;
color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);

&.success {
background: #4CAF50;
}

&.error {
background: #F44336;
}

&.info {
background: #3F51B5;
}
}

&.outline {
border-radius: 30px;
min-height: 38px;
line-height: 1.1em;
background-color: white;
border: 1px solid #676767;
padding: 0 20px;
font-size: 15px;
color: #676767;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
font-weight: bold;

&.success {
color: #4CAF50;
border-color: #4CAF50;
}

&.error {
color: #F44336;
border-color: #F44336;
}

&.info {
color: #3F51B5;
border-color: #3F51B5;
}
}
}
}

@media only screen and (max-width: 600px) {
#toasted-container {
min-width: 100%;
bottom: 0%;
}
}

@media only screen and (min-width: 601px) and (max-width: 992px) {
#toasted-container {
max-width: 90%;
}
}

@media only screen and (min-width: 993px) {
#toasted-container {
max-width: 86%;

&.top-right {
top: 10%;
right: 7%;
}

&.top-left {
top: 10%;
left: 7%;
}

&.top-center {
top: 10%;
left: 50%;
transform: translateX(-50%);
}

&.bottom-right {
right: 5%;
bottom: 7%;
}

&.bottom-left {
left: 5%;
bottom: 7%;
}

&.bottom-center {
left: 50%;
transform: translateX(-50%);
bottom: 7%;
}

&.top-left .toasted, &.bottom-left .toasted {
float: left;
}
}
}

@media only screen and (max-width: 600px) {
.toasted {
width: 100%;
border-radius: 0;
}
}

@media only screen and (min-width: 601px) and (max-width: 992px) {
.toasted {
float: left;
}
}

@media only screen and (min-width: 993px) {
.toasted {
float: right;
}
}
Loading

0 comments on commit 9cb93be

Please sign in to comment.