alitaheri / jss-rtl

Flip styles using rtl-css-js
MIT License
83 stars 5 forks source link

Add support for array properties #4

Closed dastoori closed 6 years ago

dastoori commented 6 years ago

This syntax doesn't work: Alternative syntax for space and comma separated values

Example:

import { create } from 'jss';
import preset from 'jss-preset-default';
import rtl from 'jss-rtl';

const jss = create({ plugins: [...preset().plugins, rtl()] });

const styles = {
  button: {
    padding: [1, 2, 3, 4],
    margin: [[1, 2, 3, 4], '!important'],  
    border: [
      [1, 'solid', 'red'],
      [2, 'solid', 'blue']
    ]
  },
}

console.log(
  jss.createStyleSheet(styles).toString()
);
/*
.button-0-1-1 {
  margin: [object Object];
  border: [object Object];
  padding: 1px 4px 3px 2px;
}

---
it should be this instead:

.button-0-1-1 {
  margin: 1px 4px 3px 2px !important;
  border: 1px solid red, 2px solid blue;
  padding: 1px 4px 3px 2px;
}
*/
alitaheri commented 6 years ago

@dastoori Great contribution, thanks 👍 👍 I'll publish a release today. Thank you.