bengott/meteor-avatar

cssClass should be named class

Closed this issue · 9 comments

Others helpers like AutoForm use the same helper argument name that the corresponding HTML tag attribute. So I suggest that we use:

{{> avatar user=user class="circle")

Plus I think the class avatar should be added automatically.

If you agree with these two changes, I can propose a PR.

👍 for cssClass -> class
👎 on adding avatar automatically. Unless it is for namespace only.

OK. It originally was just class -- can't remember why I changed it. Anyway, that's fine by me.

As for the 'avatar' class, it is currently automatically added when the class/cssClass is undefined, but otherwise it's not. In order for it to be automatically added along with 'large', 'rounded', 'circle', etc., I would have had to do extra string handling to make sure it wasn't a custom css class string, so I skipped it. In retrospect, it probably wouldn't be that difficult to just check against a whitelist of approved modifier classes and add 'avatar' when necessary. If you want to do that, go for it!

And thanks for the interest, guys! :)

Actually we probably want to display avatars with the same style everywhere (a square? a circle? a shadow?). The main parameter that we are likely to change depending on the context is the size of it (big on a profile page, medium next to message, and small for the list of people who liked a message).

I think the .avatar class should be automatically added, with a default style that the developer is free to customize.

For reference, the reason I don't want .avatar added automatically, with styling, is because I am using Semantic UI to style the img for me. Though, it is worth notting that the current .avatar is not negatively effecting me.

+1 for adding avatar automatically , i agree with @mquandalle on this!

@Kestanous as you say, with semantic ui you can just add the proper classes since .avatar doesnt affect it's styling

@bengott awesome stuff!!! I see lots of potential here!

@mquandalle Good idea about the sizes and styles. It would be cool to be able to specify those in the config options (e.g. { style: circle, large: 100, medium: 50, small: 30 }). Would that be easy to integrate into the stylesheet? I seem to recall reading something about incorporating regular javascript variables into stylus...

The problem is that meteor packages don't have a config. So things like Accounts.config(options) actually happen at runtime, and thus you can't modify assets (like css). But we can keep a stylesheet with the different variations of style and choose the one we want to use at runtime.

Gotcha. Also, it's easy enough to override the css to use your own sizes and styles (via custom classes or by overriding the provided classes).

Fixed. d8d323b