This repository has been archived by the owner on Jun 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Split spacingProps into margin/paddingProps
- Loading branch information
1 parent
090a8f2
commit 56fa273
Showing
10 changed files
with
97 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import borderProps from './borderProps'; | ||
import flexProps from './flexProps'; | ||
import paddingProps from './paddingProps'; | ||
import positionProps from './positionProps'; | ||
import spacingProps from './spacingProps'; | ||
import marginProps from './marginProps'; | ||
import textProps from './textProps'; | ||
|
||
export {borderProps, flexProps, positionProps, spacingProps, textProps}; | ||
export { | ||
borderProps, | ||
flexProps, | ||
paddingProps, | ||
positionProps, | ||
marginProps, | ||
textProps, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {getSpacing} from '../utils/spacing'; | ||
import {checkTheme} from '../utils/theme'; | ||
|
||
function marginProps(props) { | ||
const {m, mx, my, mt, mr, mb, ml, theme} = props; | ||
|
||
checkTheme(theme); | ||
|
||
return { | ||
margin: m ? getSpacing(m, theme) : undefined, | ||
marginTop: my | ||
? getSpacing(my, theme) | ||
: mt | ||
? getSpacing(mt, theme) | ||
: undefined, | ||
marginRight: mx | ||
? getSpacing(mx, theme) | ||
: mr | ||
? getSpacing(mr, theme) | ||
: undefined, | ||
marginBottom: my | ||
? getSpacing(my, theme) | ||
: mb | ||
? getSpacing(mb, theme) | ||
: undefined, | ||
marginLeft: mx | ||
? getSpacing(mx, theme) | ||
: ml | ||
? getSpacing(ml, theme) | ||
: undefined, | ||
}; | ||
} | ||
|
||
export default marginProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {getSpacing} from '../utils/spacing'; | ||
import {checkTheme} from '../utils/theme'; | ||
|
||
function paddingProps(props) { | ||
const {p, px, py, pt, pr, pb, pl, theme} = props; | ||
|
||
checkTheme(theme); | ||
|
||
return { | ||
padding: p ? getSpacing(p, theme) : undefined, | ||
paddingTop: py | ||
? getSpacing(py, theme) | ||
: pt | ||
? getSpacing(pt, theme) | ||
: undefined, | ||
paddingRight: px | ||
? getSpacing(px, theme) | ||
: pr | ||
? getSpacing(pr, theme) | ||
: undefined, | ||
paddingBottom: py | ||
? getSpacing(py, theme) | ||
: pb | ||
? getSpacing(pb, theme) | ||
: undefined, | ||
paddingLeft: px | ||
? getSpacing(px, theme) | ||
: pl | ||
? getSpacing(pl, theme) | ||
: undefined, | ||
}; | ||
} | ||
|
||
export default paddingProps; |
This file was deleted.
Oops, something went wrong.