Skip to content

Commit

Permalink
feat(presets): add a few handy props to the default presets
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Mar 29, 2021
1 parent 08d7c7c commit d3ce18a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const shorthands = {
d: {
properties: ['display']
},
pos: {
properties: ['position']
},
top: {
properties: ['top'],
token: 'space',
Expand Down Expand Up @@ -64,11 +67,6 @@ const shorthands = {
properties: ['height'],
unit: percOrPx
},
mw: {
properties: ['maxWidth'],
token: 'width',
unit: percOrPx
},
c: {
properties: ['color'],
token: 'color'
Expand All @@ -90,6 +88,9 @@ const shorthands = {
properties: ['order'],
unit: str
},
fd: {
properties: ['flexDirection']
},
m: {
properties: ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'],
token: 'space',
Expand Down Expand Up @@ -188,15 +189,16 @@ const shorthands = {
}

shorthands.display = shorthands.d
shorthands.position = shorthands.pos
shorthands.width = shorthands.w
shorthands.height = shorthands.h
shorthands.maxWidth = shorthands.mw
shorthands.color = shorthands.c
shorthands.background = shorthands.bg
shorthands.flexWrap = shorthands.fw
shorthands.alignItems = shorthands.ai
shorthands.justifyContent = shorthands.jc
shorthands.order = shorthands.o
shorthands.flexDirection = shorthands.fd
shorthands.margin = shorthands.m
shorthands.marginTop = shorthands.mt
shorthands.marginBottom = shorthands.mb
Expand Down Expand Up @@ -245,7 +247,10 @@ const macros = {
h: { h: 1 },
tac: { ta: 'center' },
tar: { ta: 'right' },
taj: { ta: 'justify' }
taj: { ta: 'justify' },
ma: { m: 'auto' },
mxa: { mx: 'auto' },
mya: { my: 'auto' }
}

module.exports = {
Expand Down

0 comments on commit d3ce18a

Please sign in to comment.