apvarun / toastify-js

Pure JavaScript library for better notification messages
https://apvarun.github.io/toastify-js/
MIT License
2.13k stars 230 forks source link

Add support for offset #49

Closed joaquinwojcik closed 4 years ago

joaquinwojcik commented 4 years ago

Add some basic support for offset as requested on #48

Usage:

Toastify({
  text: "This is a toast with offset",
  offset: {
    x: 50, // horizontal axis - can be a number or a string indicating unity. eg: '2em'
    y: 10 // vertical axis - can be a number or a string indicating unity. eg: '2em'
  },
}).showToast();

Toast will be pushed 50px from right in x axis and 10px from top in y axis.

Example: image

If position is equals to left, it will be pushed from left. If gravity is equals to bottom, it will be pushed from bottom.

Example: image

Also updated the docs.

lwxbr commented 4 years ago

PING @apvarun

apvarun commented 4 years ago

@joaquinwojcik @Tadaz Appreciate your pull requests. Both of you have PR's for similar feature.

My opinion: I prefer the API from #49 but also include offset between toasts like in #45 Would like to know your use cases too so that we can decide on one common way of adding offsets.

aconital commented 4 years ago

@apvarun any update on this?

apvarun commented 4 years ago

@aconital Do you mind contributing your thoughts on which of the implementation is better suited for this use-case? #49 or #45

aconital commented 4 years ago

@apvarun I personally prefer #49 for offset.

joaquinwojcik commented 4 years ago

PING @apvarun

I've updated the README. I thinks its ready to merge.

apvarun commented 4 years ago

Version 1.9.0 contains your changes @joaquinwojcik https://www.npmjs.com/package/toastify-js/v/1.9.0