themeteorchef / bert

A client side, multi-style alerts system for Meteor.
185 stars 27 forks source link

Add support for storing templates #43

Open themeteorchef opened 7 years ago

themeteorchef commented 7 years ago

There should be a simple API for storing alert templates. E.g., we may always want to use the same alert over and over with a different (optional) title/type/message. It should be possible to do something like:

Bert.templates = {
  error(message, type, title) {
    return { message, type: 'growl-top-right', title, style: 'danger', icon: 'fa-remove' };
  },
};

// In the app

Bert.error('Something went wrong'); // No need to do Bert.alert('Something went wrong', 'danger');