Tradeshift / tradeshift-ui

The Tradeshift UI Library & Framework
https://ui.tradeshift.com
Other
33 stars 45 forks source link

Button is shown twice with ts-danger class in v12.3.0 #851

Closed akarnachuk closed 5 years ago

akarnachuk commented 5 years ago

Describe the bug Header button is shown twice when type contains ts-danger with one of ts-primary, ts-secondary or ts-tertiary

To reproduce ts.ui.TopBar.buttons([{label : 'Primary', type : 'ts-primary ts-danger'}]

Expected behavior Show the requested quantity of buttons.

Framework usage

Additional context http://ui.tradeshift.com/v12/#components/header/buttons.html image

Also such types produce multiply buttons: 'ts-primary ts-secondary', 'ts-primary ts-secondary', ts-secondary ts-danger-no-matter-what-is-added-after

zdlm commented 5 years ago

Hi @akarnachuk . Thanks for report Why do you put ts-primary and ts-danger those two together. Which is not make sense. You can put your own class here but not an tradeshift-ui button type.

We reuse the buttonCollection check in the same logic. https://github.com/Tradeshift/tradeshift-ui/blob/master/src/runtime/js/ts.ui/bars/bars-api@tradeshift.com/models/local/bar/ts.ui.BarModel.js#L18 It might break other stuff if I change it here. I think it is easy for you stop use the wrong way . Thanks