jss icon indicating copy to clipboard operation
jss copied to clipboard

[jss-default-unit] Unit is inflexible.

Open jeffmcmahan opened this issue 10 years ago • 6 comments

default-unit assigns px as the default unit for animation-duration (should be ms):

exampleClass: {
  animationDuration: 100
}

Becomes:

.exampleClass--jss-0-34 {
  animation-duration: 100px;
}

I looked over the source and tests. The plugin accepts an object parameter specifying which unit will serve as the default unit, and that unit is used for everything. If we pass {unit: 'ms'}, it would fix the case given above, but would also cause this: height: 100 -> height: 100ms.

N.b.: I will make a PR later today, offering more flexibility and choice among default units.

jeffmcmahan avatar Jul 16 '16 17:07 jeffmcmahan

It's a bug, we are missing this property in this list https://github.com/jsstyles/jss-default-unit/blob/master/src/numericProps.js

Initial idea was to just have one default unit, because everything else is a very rare use case ....

kof avatar Jul 16 '16 17:07 kof

If we start maintaining different defaults for sizes and times etc the list might become pretty big. Not sure it's worth it.

kof avatar Jul 16 '16 17:07 kof

Lets fix the bug for now, we can open an enhancement issue for multiple defaults. I want to see lots of people voting for this enhancement before we add it.

kof avatar Jul 16 '16 17:07 kof

Will add this prop in a bit to the list.

kof avatar Jul 16 '16 17:07 kof

released

kof avatar Jul 16 '16 17:07 kof

Just opened an issue (looking for an enhancement label, as you suggested): https://github.com/jsstyles/jss/issues/272

jeffmcmahan avatar Jul 16 '16 22:07 jeffmcmahan