Code Monkey home page Code Monkey logo

Comments (8)

wavded avatar wavded commented on July 18, 2024

Ahh I see, you could try putting the css for one of the other themes under like humane.humane-info in original.css (and use humane.info to get that theme), if that makes sense. A little bit of a hack as the API doesn't currently support what you are asking in a simple way.

from humane-js.

Gooseus avatar Gooseus commented on July 18, 2024

So I'd essentially be splicing two themes together in to a custom theme which utilizes one theme style with 'info' / 'log' type and the other with the 'error' / 'success' type?

That could work, though I've found that the jackedup seems to be a nice combination of bold and unobtrusive, I kind of like it everywhere right now. I can still foresee instances where I may want to split out multiple themes.

Have you thought about allowing users to add a class attribute in the humane.create() builder function? That way one could create an error like:

var error = humane.create({ type: 'error', class: 'fatal', waitForMove: true, });
error('Yikes');

Which would add a .humane-fatal class instead of the .humane-error? ... Actually, I just checked through your code and I'm wondering if you couldn't just do that by adding your own 'type'? It seems like you may only actually using the type to append on to the humane- className and to fire custom events.

So you might actually be able to extend an existing theme pretty easily with the existing codebase which would also come with it's own custom events to handle a 'fatal' error type differently from a regular 'error' type, as well as giving it a slightly different skin. I still think there might be some value to adding additional custom event and class options so you could extend 'error' type in to 'fatal' and still get an onerror event along with the onfatal, but correct me if I'm wrong, it seems like just the custom type extension would work with minimal updates... what do you think?

from humane-js.

wavded avatar wavded commented on July 18, 2024

correct, you could use type and put whatever you want in it as long as you make a humane-type class, but again your base css gets inherited so you may want need to pull some of that out and put it in the subclasses so both themes work

from humane-js.

wavded avatar wavded commented on July 18, 2024

yeah class and type are sorta the same thing when creating, since it looks for a class called 'humane-{type}'

from humane-js.

Gooseus avatar Gooseus commented on July 18, 2024

Awesome, it can still serve the function of extending the given themes so that you can have yellow, orange, red, or black for progressive levels of error/notification by just adding a few more style rules and creating the custom notifiers.

The documentation makes the humane.create() seem like it can only be used for currying a custom function from existing static types, when in reality you can get pretty creative depending on what you're trying to do. I think I could easily go back to using the original style, add a single .humane-autosave rule which changes the top, font-size, min-height and width to be less obtrusive and utilize that custom notifier for that specific case.

You should think about updating the Custom Notifier section of the docs to let people know it's more flexible than they may realize. Awesome work, btw, simple, light and unassuming.. I'm thinking of using it as a model for a humane-like tooltip plugin for handling notifications which are specific to an element or location on the page.

from humane-js.

wavded avatar wavded commented on July 18, 2024

yeah should update the docs (I honestly wasn't sure how many would try what you are doing but its totally doable)... my goal is simplicity, I almost want to gut out the standard humane.info|error|log|success and just have humane and humane.create (where you can roll your own). humane.create came after the others.

from humane-js.

Gooseus avatar Gooseus commented on July 18, 2024

Yeah, that's a good idea, the docs would be way simpler and much more accurate if you focused on the humane.create function as the core from which you can roll any number of notifications and make the built-in notifications a footnote.

Though if you removed them completely the themes would be kind of bland. You could use them as examples of the ease with which you can extend the base themes and notifications with 1 line of js and 1 css rule though.

from humane-js.

wavded avatar wavded commented on July 18, 2024

this is implemented per 3.0.0 release

from humane-js.

Related Issues (20)

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.