Skip to content

Commit b4082cf

Browse files
committed
fix: handle dynamic values and 3-value padding/margin shorthand
1 parent 86367bc commit b4082cf

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/babel-plugin-kstyled/src/css-parser.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ function expandShorthand(property: string, value: string): Record<string, any> |
216216
paddingVertical: parts[0],
217217
paddingHorizontal: parts[1],
218218
};
219+
} else if (parts.length === 3) {
220+
// padding: top horizontal bottom
221+
return {
222+
paddingTop: parts[0],
223+
paddingHorizontal: parts[1],
224+
paddingBottom: parts[2],
225+
};
219226
} else if (parts.length === 4) {
220227
// padding: top right bottom left
221228
return {
@@ -232,6 +239,13 @@ function expandShorthand(property: string, value: string): Record<string, any> |
232239
marginVertical: parts[0],
233240
marginHorizontal: parts[1],
234241
};
242+
} else if (parts.length === 3) {
243+
// margin: top horizontal bottom
244+
return {
245+
marginTop: parts[0],
246+
marginHorizontal: parts[1],
247+
marginBottom: parts[2],
248+
};
235249
} else if (parts.length === 4) {
236250
// margin: top right bottom left
237251
return {

0 commit comments

Comments
 (0)