katemihalikova / ion-datetime-picker

Date and/or time picker for awesome Ionic framework
MIT License
169 stars 101 forks source link

Able to change buttons's style #68

Closed WilliamDASILVA closed 7 years ago

WilliamDASILVA commented 7 years ago

Hello there,

I added the possibility to change the button's class via the $ionicPickerI18n object.

$ionicPickerI18n.buttonStyle = {
        ok : 'btn white',
        cancel : "btn white grey"
    };

William

katemihalikova commented 7 years ago

Hi William, thanks for your code!

I believe that all custom stylings should be done via scss/css, not javascript. You can easily override all styles, including buttons, using base .ion-datetime-picker-popup class.

I know that the styling of the buttons is not done in the best way now. I will consider some better way for the next mayor release.

Thanks anyway, good job!

jonathan-chin commented 7 years ago

I was actually just about to submit this pull request.

I understand your rationale for keeping styling separate from logic @katemihalikova but altering the buttons would be too clunky otherwise. For example, I want to change the cancel button from "button-stable" to "button-dark button-outline" to match the aesthetics of the rest of my app. To do this with pure scss / css would be very clunky.

katemihalikova commented 7 years ago

I see that ionic mixins are not help here as they are too specific to fit this use-case. Using @extend .button-dark.button-outline; syntax should help, but it's not very elegant.

Seems like @WilliamDASILVA deleted their fork and I'm not able to reopen this, I'll open a new PR myself then.

WilliamDASILVA commented 7 years ago

Yes I've deleted indeed because I've found that same solution to change it via SCSS as you said above. It did the trick as expected but It would be better without.

katemihalikova commented 7 years ago

No problem, I've managed to get the feature released anyway. You were right that this way it's far easier. I've somehow thought that ionic has nice mixins for buttons but it seems that I've confused it with sth else. Thanks for your work!