-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Border, Padding, and Margin shorthands #56
Conversation
f55755b
to
4334e4a
Compare
@mxstbr Wanted to get your eyes on this implementation before I wrote up the docs for it. |
Looks really good from a first glance! 😱 |
7043d14
to
165cc6a
Compare
Current coverage is 100% (diff: 100%)@@ master #56 diff @@
===================================
Files 21 28 +7
Lines 84 107 +23
Methods 0 0
Messages 0 0
Branches 0 0
===================================
+ Hits 84 107 +23
Misses 0 0
Partials 0 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update types, otherwise this looks great!
* } | ||
*/ | ||
|
||
function position(positionKeyword: string|null, ...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
* } | ||
*/ | ||
|
||
function padding(...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
* } | ||
*/ | ||
|
||
function margin(...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
return splitPropertyName.join('-') | ||
} | ||
|
||
function generateStyles(property: string, valuesWithDefaults: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
* } | ||
*/ | ||
|
||
function borderColor(...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
* } | ||
*/ | ||
|
||
function borderStyle(...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
* } | ||
*/ | ||
|
||
function borderWidth(...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
* } | ||
*/ | ||
|
||
function directionalProperty(property: string, ...values: Array<string|null>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set null
as a type flow will think that's an any
, which we need to avoid. Instead of saying that, do param: ?string
. That'll tell flow that the param is null-able!
Shorthand helpers for border-width, border-color, border-style, margin, padding, and the general directionalProperty helper
Added docs for new shorthands, added flow to test files misssing it, added npm run docs command to serve docs locally, fixed doc typos
7b30e5c
to
e1feb49
Compare
@mxstbr should be good now. |
Odd I'm not seeing those, let me re-push the rebase onto master and see if that fixes it for ya. |
e1feb49
to
c26de2c
Compare
Update types on directional shorthands to properly show values array elements are nullable.
c26de2c
to
05215d3
Compare
k @mxstbr did another force push of my branch. I've had some wonkiness going on with my pushes today, as I'm working from Taiwan and the connection isn't always stable. Hopefully that fixed it. |
Awesomeeee!! |
Shorthand helpers for border-width, border-color, border-style, margin, padding, and the general directionalProperty helper.