This commit is contained in:
Nate Butler
2023-08-29 16:02:04 -04:00
parent 33c9f14852
commit d91a9615b5
27 changed files with 354 additions and 244 deletions
+15 -8
View File
@@ -16,19 +16,26 @@ export type MarginStyle = {
export const margin_style = (options: MarginOptions): MarginStyle => {
const { all, top, bottom, left, right } = options
if (all !== undefined) return {
top: all,
bottom: all,
left: all,
right: all
}
if (all !== undefined)
return {
top: all,
bottom: all,
left: all,
right: all,
}
if (top === undefined && bottom === undefined && left === undefined && right === undefined) throw new Error("Margin must have at least one value")
if (
top === undefined &&
bottom === undefined &&
left === undefined &&
right === undefined
)
throw new Error("Margin must have at least one value")
return {
top: top || 0,
bottom: bottom || 0,
left: left || 0,
right: right || 0
right: right || 0,
}
}