-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Custom base class #99
Comments
That's a good idea and I was just looking for the same functionality. It would be nice if we could pass an extra parameter to the custom message api similar to the already existing functionality of passing a custom timeout:
Edit: Managed to find a workaround by using add() instead: |
@FredUK Thanks for the info. In my case, I didn't want to mess with the Bootstrap base class at all, because it's being used elsewhere. |
You're not messing with the bootstrap base class. # By calling add({type: danger extraClass}) the plugin will prepend alert-" to your classes which will become "alert-danger extraClass" which is the default bootstrap class. If you want a success message with an extra class you could do .add({type: "success extraClass"}) which will be turned into "alert-success extraClass". (which is the default success for bootstrap). |
Thanks for the reply. I should have been clearer and said I didn't want to apply the "alert" base class at all, but rather have my own namespaced version, something like |
This is also of interest to us at Precision Nutrition. We use BEM to organize our CSS and would like to apply this to our flash styles without having to override the component. Configuring the base class, and prefix, would go a long ways to helping us. |
I'm removing class names from 2.0, you'll be able to pass in whatever you want for each message and use a helper to precisely compose a class name you need for your styles. I expect to have it released pretty shortly. You can follow the progress on the https://github.com/poteto/ember-cli-flash/tree/two-point-oh branch {{#flash-messages flashes=flashMessages.arrangedQueue as |flash|}}
{{#flash.component class=(concat "alert alert-" flash.type) click=(action flash.close)}}
<h6>{{capitalize flash.type}}</h6>
<p>{{flash.message}}</p>
{{/flash.component}}
{{/flash-messages}} |
Super cool! Many thanks for the heads up. |
It's nice that Bootstrap and Foundation are supported out-of-the-box, but it seems like it wouldn't be too much more effort just to make the base class and type prefix configurable. I know this could be achieved by subclassing the flash component, but it seems like a good fit for addon-level configuration when there's already type configuration available.
I'd be happy to create the PR if desired.
The text was updated successfully, but these errors were encountered: