aesthetic-suite / framework

🎨 Aesthetic is an end-to-end multi-platform styling framework that offers a strict design system, robust atomic CSS-in-JS engine, a structural style sheet specification (SSS), a low-runtime solution, and much more!
https://aestheticsuite.dev
MIT License
203 stars 5 forks source link

fix: Rework variants to use nested objects. #110

Closed milesj closed 3 years ago

milesj commented 3 years ago

Summary

Changes the former structure of:

'@variants': {
  size_sm: css.mixin('text-sm', {
    minWidth: css.unit(4),
    padding: {
      leftRight: css.var('spacing-sm'),
      topBottom: css.var('spacing-xs'),
    },
  }),
  size_df: css.mixin('text-df', {
    minWidth: css.unit(6),
    padding: {
      leftRight: css.var('spacing-df'),
      topBottom: css.var('spacing-sm'),
    },
  }),
  size_lg: css.mixin('text-lg', {
    minWidth: css.unit(8),
    padding: {
      leftRight: css.var('spacing-md'),
      topBottom: css.var('spacing-df'),
    },
  }),
},

To:

'@variants': {
  size: {
    sm: css.mixin('text-sm', {
      minWidth: css.unit(4),
      padding: {
        leftRight: css.var('spacing-sm'),
        topBottom: css.var('spacing-xs'),
      },
    }),
    df: css.mixin('text-df', {
      minWidth: css.unit(6),
      padding: {
        leftRight: css.var('spacing-df'),
        topBottom: css.var('spacing-sm'),
      },
    }),
    lg: css.mixin('text-lg', {
      minWidth: css.unit(8),
      padding: {
        leftRight: css.var('spacing-md'),
        topBottom: css.var('spacing-df'),
      },
    }),
  },
},

Since it's easier to read and naturally groups related variants.

Screenshots

Checklist