-
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/native toolbar component ui #11827
Merged
Merged
Changes from 27 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
ff3cd91
Change dashicon color
marecar3 e28480f
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 3cff075
Fixed Toolbar style
marecar3 6a06306
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 442a6eb
Style refactor
marecar3 5c6ae4f
Small refinment
marecar3 b60acce
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 565bd08
Small fixes
marecar3 125a576
Small fixes
marecar3 7588291
Small fix
marecar3 826bec4
Temp push
marecar3 c79a483
Implemented selected state
marecar3 a5aa2f2
Fixed naming
marecar3 7c6c0f4
Small fixes
marecar3 4aaac80
Rename css files
marecar3 54440b6
Lint fixes
marecar3 ee7a909
Added EOF line
marecar3 2560918
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 2fa504d
Removed path const
marecar3 66e210f
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 45643fa
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 4fed682
Small fix
marecar3 dc8c21a
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 0809e9f
Small fix
marecar3 fc6cf65
Fixed lint errors
marecar3 bdb66bf
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 1c7dfc4
Fixed styles from comment
marecar3 0162da0
Fixed path
marecar3 51956f8
Flow error fix
marecar3 746c90a
Fixes from comments
marecar3 49e82b4
FIxed lint errors
marecar3 b22ad2e
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 56640cd
Fixes from comments
marecar3 591ce94
Updated dashicon unselected state color
marecar3 0c81045
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 5e6e9d2
Fixes from comments
marecar3 bfdab84
Fixed lint errors
marecar3 a9aa8e5
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 168f08b
Merge branch 'master' into rnmobile/native-toolbar-component-ui
marecar3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const IconClass = ( props ) => { | ||
const { icon, className } = props; | ||
return [ 'dashicon', 'dashicons-' + icon, className ].filter( Boolean ).join( ' ' ); | ||
}; |
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,4 @@ | ||
export const IconClass = ( props ) => { | ||
const { icon, className, ariaPressed } = props; | ||
return [ ariaPressed ? 'dashicon-active' : 'dashicon', 'dashicons-' + icon, className ].filter( Boolean ).join( ' ' ); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.dashicon { | ||
color: #87a6bc; | ||
fill: currentColor; | ||
} | ||
|
||
.dashicon-active { | ||
color: #fff; | ||
fill: currentColor; | ||
} | ||
|
||
.dashicons-insert { | ||
color: #87a6bc; | ||
fill: currentColor; | ||
} |
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,7 @@ | ||
.container { | ||
flex-direction: row; | ||
border-right-width: 1px; | ||
border-right-color: #e9eff3; | ||
padding-left: 5px; | ||
padding-right: 5px; | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure I understand this change? why do we need aria-pressed here since we're applying it to the parent button?
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.
The underlying issue is that we need to find a way to set the color of a
Dashicon
. Since the web has CSS it can use class names, inheritance, andfill: currentColor
to get to that. But we don't have that on native.Ideally we'd be able to set
color
orstyle
on a Dashicon, I took an alternate approach in #12403, but that was easier since I was using Dashicon directly. For this we'd have to make everything in the hierarchy forward the style down to Dashicon. As mentioned on that PR, you can setextraProps
inIconButton
, but those will go to theButton
, not the icon.We just found something that worked to keep us moving although we were aware it wasn't great, so I'm happy to discuss a better solution 😁
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'm concerned about these small tweaks having an impact on the web code base, can't we create an
icon-button
native version instead?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.
@koke Can you point me to where this occurs? As best I can follow, the main impact of the
ariaPressed
prop is in changing the class behavior ofDashicon
to applydashicon-active
in the native context, but I see no reference todashicon-active
anywhere in Gutenberg or Gutenberg Mobile aside from where we apply it.I'd tend to agree with @youknowriad here. "Pressed" does not resound to me as a characteristic of an icon, and thus it does not make sense as a prop. It does, however, seem natural to describe the state of an
IconButton
.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 think this is what's setting the style https://github.com/WordPress/gutenberg/blob/master/packages/components/src/primitives/svg/style.native.scss#L6
I agree that this isn't ideal. It seems like the introduction of
iconProps
in #13977 could be a good solution to pass custom styles fromIconButton
toDashicon
?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 don't know that #13977 is an improvement here, as I expect you'd continue to treat it as a pressed icon, which is the root of the issue ("pressed" is not a sensible state of an icon).
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.
Ah, that's right.
It looks like the right logic here would be that
IconButton
set different style props onDashicon
depending onisActive
. This seems to be what the web is doing, although via CSS.However this is overriden by CSS in the
ToolbarButton
component.We keep bumping into this on native: the web can rely on nested CSS definition to pass style down to lower level components, but we can't do that unless we pass them explicitly. I still think
ToolbarButton
should be somehow deciding what the style forDashicon
is when normal/pressed, which is why now havingiconProps
inIconButton
seems like a way out.@etoledom can you handle this (removing ariaPressed from Dashicon) as part of #13977?