Giter VIP home page Giter VIP logo

vuenotification's Introduction

Notification Vue JS ๐Ÿš€

๐Ÿšจ๐Ÿšจ๐Ÿšจ Not maintained anymore

The Notification vue plugin allows you to display notifications from anywhere within your app. Just with one line of code. This notification plugin is unique from others as it utilises the GSAP library allowing you to animate your notifications in a near limitless number of ways

img vue notification img vue notification

How to use it

Install with npm. If you don't already have GSAP in your project, you also have to install it.

npm i @kugatsu/vuenotification --save
npm i gsap --save

Import with ES6

import VueNotification from "@kugatsu/vuenotification";

Vue.use(VueNotification, {
  timer: 20
});

Emit the notification where you want.

this.$notification.new("hello world", {  timer: 10 });
this.$notification.error("hello world", { infiniteTimer: false });
...

Parameters

Name Type Default value
message String "๐Ÿšง You missed something ..."
title String null
timer Number 5(s)
infiniteTimer Boolean false
position String topRight
type String primary
[type] Object ( See type section )
showLeftIcn Boolean true
showCloseIcn Boolean false
animateIn Function ()=> TimelineMax
animateOut Function ()=> TimelineMax
messageIsHTML Boolean false

position

Name Value
top center topCenter
top left topLeft
top right topRight
bottom center bottomCenter
bottom left bottomLeft
bottom right bottomRight

Type

There are 5 notifications types.

  • primary
  • dark
  • success
  • warning
  • error

To customise the colors of the notification you can do this globally or locally :

// Sample to change all error notifications
Vue.use(NotificationVuejs, {
  error: {
    background: "green",
    color: "red"
  }
});

Animation

To animate the in and out animation, we use GSAP. To customize the default animation, you have to add to your config object. animateIn and animateOut with a function that returns a gsap timeline.

Vue.use(NotificationVuejs, {
  animateIn: function() {
    var tl = new TimelineMax()
      .from(this.notificationEl, 0.6, {
        opacity: 0
      })
      .from(this.notificationEl, 0.4, {
        borderRadius: 100,
        width: 58,
        height: 58
      })
      .from(this.notificationElContent, 0.3, {
        opacity: 0
      });
    return tl;
  }
});

You can select the notification with a custom selector.

Selector Value to use
all notification this.notification
current notification this.notificationEl
all content of the notification this.notificationElContent
Notification title this.notificationTitle
Notification message this.notificationMessage
Notification icone this.notificationIcone
Notification close button this.notificationIconeClose

Credit

Icones

Icons made by Pixel perfect, Smashicons from www.flaticon.com is licensed by CC 3.0 BY

vuenotification's People

Contributors

ciworks avatar dependabot[bot] avatar kugatsu765 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vuenotification's Issues

Customize left icon

Hello.

Is it possible to customize the left side icon SVG and add my own?

If it is impossible can you please add this feature in the future?

Thank you.

Please make following fix

function createNotification(lConf) {
var ComponentClass = Vue.extend(Notification);
var newComponent = new ComponentClass({
el: document.createElement("div"),
propsData: _objectSpread({}, options, lConf)
});
notifications.push(newComponent);
return newComponent;
}

thanks for your work - great component

Missing the GSAP module instructions

Hi I installed this module (vueNotification) but got a error messageModule not found: Error: Can't resolve 'gsap' in '/var/www/html/node_modules/@kugatsu/vuenotification/dist'.

I solved it installing the module GSAP but is missing instruction in the documentation about it or another way is to include as dependence on this module.

Make possible to change position of notification from absolute to fixed

The problem arises when using notifications in a really long page.

I currently have the position set to bottomRight. When I scroll up, the notification will be scrolled out. This is not always the desired behavior.

Would it be possible to allow for a configuration setting .notificationCenter position to fixed?

new line

est-il possible d'utiliser une nouvelle ligne (new line ) dans le message?

Customize font

Hello.
Is it possible to customize fonts of title and message text?
If it is impossible can you add this feature?

import TimelineMax from 'gsap';

Hi. I've decided to use your package in my project and certain things I cannot configure very well. Basically, what I'm trying to accomplish is to reduce animation time that is quite slow and then I followed your instructions. First, I imported TimelineMax from GSAP

import TimelineMax from 'gsap';

Then I start to configure the notification:

this.$notification.success(message, { title: this.t('messages.SUCCESS'), timer: 5, animateIn: () => { let tl = new TimelineMax() .from(.vn-notif${this.uuid}, 0.6, { opacity: 0 }) .from(this.notificationEl, 0.4, { borderRadius: 100, width: 20, height: 20 }) .from(.vn-notif${this.uuid}>div, 0.3, { opacity: 0 }); tl.pause(); return tl; } });

And I've got an error in console: Cannot tween a null target. I tried to debug it with no success. What's actually happening in this case?

Error Gsap TimelineMax is not defined

I had declared properly the import and the Vue Use.

I have this error only if a specify the animateIn in the Vue.use.

When i call the notification in a Vue component, the notification works as expected but an error appear in the debug console :

[Vue warn]: Error in mounted hook: "ReferenceError: TimelineMax is not defined"
(found in )

Can we use thus notification from vuex store

I have an action which is triggered if an api request throws an error. i would like to take this error message and display them to user from the action. Does such a functionallity exist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.