Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Close method and Icon option #1

Open
xxRockOnxx opened this issue Apr 5, 2017 · 4 comments
Open

[Request] Close method and Icon option #1

xxRockOnxx opened this issue Apr 5, 2017 · 4 comments

Comments

@xxRockOnxx
Copy link

xxRockOnxx commented Apr 5, 2017

Would like to have both of those :)
Great work for being minimal!

I'll try to make a minimal change and make a PR for the close method

I think I'll be making a breaking changes. Thought I could just make the closeMessage public and make a growl by doing new growl({ ...opts }). Works for me that way, but the tests failed and hence introduces breaking changes.

I'll just trigger a click to close it.

@vfreitas-
Copy link
Owner

vfreitas- commented Apr 5, 2017

How would this icon option work? Allow you to define a class or html for the icon? e.g a font-awesome class or even a SVG ?

About the close method, for a simple solution I can think about something like this:
src/index.js line 80
$el.close = closeMessage

Works just fine http://codepen.io/vfreitas-/pen/zZXewx

What do you think? Feel free to make a PR if you want, contributions are welcome 😄

@xxRockOnxx
Copy link
Author

Wow, so glad this is still active.

Yes, either SVG or font-awesome will do. Better if something like:

Option Type Default
icon String/Boolean false

Now if it's a string, it'll be a class containing the icon you want OR the SVG. That's for the default growl.

If it's growl.error() and the others... add a default icon.

Hmm, I'm not sure tho if it's good to extend DOM element. I'll stick with click for a while.

@vfreitas-
Copy link
Owner

I've released the version 1.0.0, and now it returns an object containing the element and the close method. So you can just do:

var gr = growl()
gr.close()
gr.$element

About the icon option, I'll try to add it this weekend.

@xxRockOnxx
Copy link
Author

That's what I actually tried but thought it'll be a breaking change so I stepped back. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants