euvl/vue-js-toggle-button

Allow the definition of colors through styling instead of configuration

Closed this issue ยท 13 comments

lehni commented

It would be nice if I could create the component in a way that would make it not set color styles from code, e.g.:

<toggle-button :color="null">
.vue-js-switch .v-switch-core {
  background: $color-grey
}
.vue-js-switch.toggled .v-switch-core {
  background: $color-active
}
euvl commented

If you will use !important, it works.

lehni commented

Using !import is a workaround at best, no? What if this is in a library for others to use, and perhaps again override the color? If my library uses !important then they're left in the dust. Would you accept a PR to turn automatic colors off?

euvl commented

I will definitely review it ๐Ÿ˜„

lehni commented

sweet, thanks! lemme try this.

euvl commented

cool, thanks! Just make sure you test it well and does not break other features ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

lehni commented

of course, I will

lehni commented

Shall I include the updated dist files in the commit as well?

lehni commented

Done: e18a628
I hope this works for you?

lehni commented

Instead of :color="null", perhaps it would be better if the value to turn this behavior off was color="none"? Happy to rewrite the commit if you agree.

euvl commented

Gave it a bit of a thought. I think the best solution would be to have prop cssColors=Boolean that turns on/off javascript color assigning. This way we do not reinvent the wheel with color or none or object or some_other_shit type of value for color prop

lehni commented

Ok, that sounds reasonable. Will change the PR!

lehni commented

Since the other color property is singular, is it a bit weird that it's in plural? Could also be useCss, or cssStyling instead, being a bit more indicative of it being a boolean also?

lehni commented

Although I guess this doesn't work for width / height, where we still need to rely on inline style to determine the radius... so mentioning color isn't wrong : )