-
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
[Mobile] Create cover block with custom colour (without an image) #23870
[Mobile] Create cover block with custom colour (without an image) #23870
Conversation
Hello @iamthomasbishop 👋 |
6b538b2
to
8c13787
Compare
@antonis Excited to see this in action! I have a few minor requests. I don't know how accurate my Figma file is in terms of margins and padding at the top/bottom of the background cell on the placeholder, but here's what I have in mind:
Here's a visual of what I'm imagining:
This is looking pretty solid already. Nice work! |
Hello @iamthomasbishop 👋
To create the above I needed to customise the Media Placeholder component also used in other blocks (e.g. Image, MediaText). Related to this I have the following questions:
|
…th_custom_color # Conflicts: # packages/block-library/src/cover/style.native.scss # packages/components/src/color-palette/index.native.js
@antonis The dynamic background color looks great, but I think it causes some friction with the content that is over it. I think we should keep the dynamic adjustment, so can we try either dimming (to something like ~30-50%, perhaps?) or hiding the contents of the placeholder (block icon, title, swatches, action) -- temporarily, while the user is selecting a custom color. Then when they cancel or apply, the contents would re-appear fully. Note: this should only apply to the starter state of the Cover block. I can't think of any other blocks off the top of my head that this would affect. |
@antonis One more tiny thing -- Can we use the same text style as the footer label on the "Text Color" setting (on a Button, for example): |
Hello @iamthomasbishop 👋 , I updated the PR with the suggested changes. Please let me know wdyt :)
|
Looks great! I think we can ship this! |
@@ -30,7 +39,9 @@ const FillWithSettingsButton = ( { children, ...props } ) => { | |||
</BottomSheetConsumer> | |||
} | |||
</Fill> | |||
{ React.Children.count( children ) > 0 && <BlockSettingsButton /> } | |||
{ React.Children.toArray( children ).filter( | |||
( child ) => child.props.dontCount !== true |
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.
@antonis Thank you for adding the comment above on dontCount
. To be honest, though I still had to reread that a few times to understand what the setting was meant to do. I wonder if we can rename it to something like excludeFromSettings
or excludeFromCount
something along those lines. WDYT?
( child ) => child.props.dontCount !== true | |
( child ) => child.props.excludeFromSettings !== true |
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 agree with you @chipsnyder and made the change. I still find this implementation a bit dirty but I couldn't find a better way to achieve 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.
Hey @antonis 👋 this is looking great! I left a couple of comments, let me know what you think.
packages/block-editor/src/components/inspector-controls/index.native.js
Outdated
Show resolved
Hide resolved
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.
Good job @antonis 🎉 left some small comments!
onCustomPress={ () => { | ||
if ( isParentSelected ) { | ||
openGeneralSidebar(); | ||
setCustomColorPickerShowing( true ); | ||
} | ||
} } |
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.
Could you please extract it to named function?
width: 32px; | ||
height: 32px; |
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.
width: 32px; | |
height: 32px; | |
width: $grid-unit-40; | |
height: $grid-unit-40; |
styles.customIndicatorWrapper, | ||
customIndicatorWrapperStyles, |
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.
Can we move it to the const since the same styles are used also in other View
?
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.
Thank you for reviewing this @lukewalczak :)
I agree with all your suggestions and submitted the changes
customVerticalSeparatorStyles={ | ||
styles.paletteVerticalSeparator | ||
} |
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 not being used, should we remove it or is there something that we need to add?
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.
You are right @geriux ! This was used at some point during the development but not any more.
I updated the PR
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.
This is working great! Thank you for the changes, just left one minor comment.
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.
LGTM! Nice work Antonis!! 🎉 Tested it on both iOS and Android.
Fixes #23868 (parent wordpress-mobile/gutenberg-mobile#2275)
Related PRs:
Description
Additionally to the palette with four default colours a Custom Colour Swatch has been added. When the user taps it, the custom colour picker UI shows. The user can tap "Cancel" to go back, or "Apply" to proceed with applying the colour.
How has this been tested?
Cover block creation with custom colour
Canceling the cover block creation
Screenshots
Types of changes
Enhancement
Checklist: