-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Full Height Alignment Toolbar: Implementation + Cover integration. #26615
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
10af26e
full-height-alignment-toolbar: initial approach
retrofox df0d647
block-editor: expose experimental full height
retrofox d4d35b1
cover: add full height button to toolbar
retrofox 1a3c7cd
cover: propagate full height to height input cpm
retrofox 7d5c333
cover: dissabel unit control in full height mode
retrofox 9562b4e
cover: store prev height to be able to return them
retrofox 81bb437
cover: set height via inline in full height mode
retrofox 4440b1b
cover: add toggle control for full height
retrofox 9a8c192
cover: set fulll height mode when saving block
retrofox ed5a6b1
full-height-alignment: change icon
retrofox 5d565e7
cover: refactoring -> simplify full height
retrofox 2c56e4f
cover: handling not prev height values.
retrofox d4cfcf3
cover: clean fullHeightAlignment attr
retrofox d6ff88f
full-height-align: change button label
retrofox 2d80e3b
full-height-alignment: pick icon from package
retrofox 7168e0c
cover: improve setting prev values
retrofox 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
3 changes: 3 additions & 0 deletions
3
packages/block-editor/src/components/block-full-height-alignment-toolbar/README.md
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,3 @@ | ||
# Full Height Toolbar Toolbar | ||
|
||
Unlike the block alignment options, `Full Height Alignment` can be applied to a block in an independent way. But also, it works very well together with these block alignment options, where the combination empowers the design-layout capability. |
25 changes: 25 additions & 0 deletions
25
packages/block-editor/src/components/block-full-height-alignment-toolbar/index.js
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,25 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { ToolbarGroup, ToolbarButton } from '@wordpress/components'; | ||
import { fullscreen } from '@wordpress/icons'; | ||
|
||
function BlockFullHeightAlignmentToolbar( { | ||
isActive, | ||
label = __( 'Toggle full height' ), | ||
onToggle, | ||
} ) { | ||
return ( | ||
<ToolbarGroup> | ||
<ToolbarButton | ||
isActive={ isActive } | ||
icon={ fullscreen } | ||
label={ label } | ||
onClick={ () => onToggle( ! isActive ) } | ||
/> | ||
</ToolbarGroup> | ||
); | ||
} | ||
|
||
export default BlockFullHeightAlignmentToolbar; |
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.
I guess these two state values could share the same useState call the value being an object with properties minHeight and minHeightUnit that could be directly passed to set attributes. These change also aligns with probable change we will have to do make minHeightUnit and minHeight a single attribute (a string that can contain multiple CSS valid properties).
If we don't initiate the state of previous to minHeight, minHeightUnit e.g: keep them undefined and also follow the suggestion of setting the previous values inside toggleMinFullHeight we can also probably remove the need for this condition bellow "// If there aren't previous values, take the default ones.".
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.
Nice suggestion. Going to refactoring using an object.
💯 agree.
I did this approach in the Background Size implementation. The data is stored in the backgroundSize attribute (string)ready to be used in the inline style. The block takes over of parsing and converting from/to this attribute to get the data usable by the UI components.
Happy to do this in a follow-up PR.