-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[RNMobile] iOS DarkMode toolbar buttons #17356
Changes from all commits
3823c6c
fec60d5
d9d6d9e
e03c6f7
640b17f
f4e5629
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -27,7 +27,6 @@ function IconButton( props, ref ) { | |||
labelPosition, | ||||
...additionalProps | ||||
} = props; | ||||
const { 'aria-pressed': ariaPressed } = additionalProps; | ||||
const classes = classnames( 'components-icon-button', className, { | ||||
'has-text': children, | ||||
} ); | ||||
|
@@ -56,7 +55,7 @@ function IconButton( props, ref ) { | |||
className={ classes } | ||||
ref={ ref } | ||||
> | ||||
<Icon icon={ icon } ariaPressed={ ariaPressed } /> | ||||
<Icon icon={ icon } /> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure that it's safe to stop passing down this prop? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's basically being replaced by this line here: But considering @Tug's comment here: https://github.com/WordPress/gutenberg/pull/17356/files#r328582023 I might need to change this anyway. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked the history and it looks like In particular, I think about
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed here: #17741. |
||||
{ children } | ||||
</Button> | ||||
); | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,5 @@ | |
} | ||
|
||
.containerDark { | ||
border-color: #515459; | ||
border-color: #525354; | ||
} |
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.
I'd rather we use a context for this:
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.
I copied the idea from here: https://github.com/WordPress/gutenberg/blob/82a96dd640354ba5068dee5a10e6195e96ea65bb/packages/components/src/primitives/block-quotation/index.native.js#L15
And the main idea was to clear up
IconButton
from sending theariaPressed
or active related states.I like that we can get enough information to style any child of button, but you are right that this might not be the best option.
I'll give this a try!
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.
Thinking about it, I guess using cloneElement should not have any impact on performance, it's just a bit more limited in terms of features. Basically, you'll only be able to access those props from the direct children of the button, whereas a consumer could be added anywhere. If direct children is fine then I guess we can keep it that way.
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.
Yes, the main (and only, so far) usage of this is the IconButton where the
Icon
component is a direct child.So, if you think it's fine to keep this, let's move on 👍
I restarted a CI job to get the ✅ from travis.
Thanks for your review!
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.
I didn't know about React Context before. Thanks for leaving this comment @Tug !