-
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
Bootstrap the widgets screen design #14612
Conversation
|
||
@include break-medium() { | ||
top: $admin-bar-height; | ||
} |
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.
A lot of these styles to properly style the sidebar and the top bar and the main area are shared with the edit-post
module. While I don't mind duplication as it's very related to the screen (those screens are similar) but I think we could extract some reusable mixins here (maybe a follow-up).
I agree. This was also proposed in the original issue. I think Riad is working his way there most likely. 😉 |
yes, actually, there's a lot more to be done here in addition to the appender change. The idea of this PR is to provide the basis in order to allow us to fix all these issues in multiple parallel PRs. Personally, the only blocker I see in this PR is #14369. It's cherry-picked here but should be solved first and then we can merge this and iterate. |
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.
Code looks good, particularly mindful of scaffolding nature of the pull request 👍 I'll give it a more thorough shake tomorrow, assuming via #14369 (comment) there's more work to be done with the parent/child store implementation.
border-left: $border-width solid $light-gray-500; | ||
background: $white; | ||
color: $dark-gray-500; | ||
height: 100vh; |
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.
Is height
necessary if top
, right
, bottom
are zero'd ?
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 really know, this is copied from the edit-post but I can test.
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 looks like an explicit change done for mobile here #1691
In my testing it doesn't impact to remove but given how fragile these things are, I prefer to leave and defer to @jasmussen
} from '@wordpress/data'; | ||
|
||
function WidgetArea( { title, initialOpen, registry } ) { | ||
// Disable reason, this rule conflicts with the React hooks rule (no conditionals) |
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.
Interesting conflict for hooks 😬 I guess we could make some assumptions around the "use" prefix for hooks as an exception. Not sure how to express that, since the rule otherwise applies to functions generally, not specific to React components.
(Should be filed as a separate issue; I can help)
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.
Should we just remove the rule? It doesn't bring me joy 😛
const [ blocks, updateBlocks ] = useState( [] ); | ||
const [ subRegistry, updateRegistry ] = useState( null ); | ||
useEffect( () => { | ||
// TODO: This behavior should be embedded in the BlockEditorProvider |
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.
Why not do it? Is it a conflict with how we use just a single provider in the post editor screen? If so, won't that always be the case?
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 requires #14369 so I was just waiting for it.
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 going to open a PR for this separately.
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.
Done in #14678
83958e9
to
5f2db99
Compare
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.
Tested and it looks like a good stub 👍 — will be useful for #14251!
} from '@wordpress/data'; | ||
|
||
function WidgetArea( { title, initialOpen, registry } ) { | ||
// Disable reason, this rule conflicts with the React hooks rule (no conditionals) |
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.
Should we just remove the rule? It doesn't bring me joy 😛
import WidgetArea from '../widget-area'; | ||
|
||
function Layout() { | ||
const areas = [ |
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.
Time for our favourite past time... ✨ naming things! ✨
It looks like WordPress calls the part of the page where a group of widgets appears a "sidebar" in the code but a "Widget Area" in the documentation. Which term should we use in Gutenberg?
I am thinking it would be confusing, after Phase 2 is merged into trunk
, to have both wp.data.select( 'core/edit-widgets' ).getWidgetAreas()
and register_sidebar()
.
(Nothing to do with this PR—just trying to get ahead of the terminology here.)
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.
Yeah, I don't really know. I don't like "sidebars" personally as it's not really what these things are meant for but I can be on board with it for consistency. @aduth our naming expert to the rescue? :P
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 help text in the current widgets screen also includes some references to this concept as a "widget area", so there's certainly precedent for both cases. I assume it's likely a matter of historical legacy on the "sidebar" naming.
Phase 2 could be a good opportunity to push to adopt the "area" naming, and move away from considering these as constrained to sidebars. Consistency with existing function naming is worth considering, but I also wonder if it's not out-of-the-question to consider a soft-deprecation of existing register_sidebar
functions in favor of newly-introduced equivalent register_widget_area
, etc. functions? It would need to be a conscious and agreed-upon effort, but I could definitely get behind "area" naming if that were an option.
In any case, I also agree that it needn't block merging this, especially as they're not exposed as part of a public interface (aside from the one class name).
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.
There was some conversation about this in the customizer issue as well. I went with "Block Areas" in the prototype.
e955150
to
158d62e
Compare
I think this is not ready to land to be able to work in parallel after. |
top: $admin-bar-height; | ||
} | ||
} | ||
@include editor-left(".edit-widgets-header"); |
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.
Possible future task: Is there sense in making this specific to "editor"? Or is it more about how the UI interacts with the admin sidebar more generally?
import WidgetArea from '../widget-area'; | ||
|
||
function Layout() { | ||
const areas = [ |
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 help text in the current widgets screen also includes some references to this concept as a "widget area", so there's certainly precedent for both cases. I assume it's likely a matter of historical legacy on the "sidebar" naming.
Phase 2 could be a good opportunity to push to adopt the "area" naming, and move away from considering these as constrained to sidebars. Consistency with existing function naming is worth considering, but I also wonder if it's not out-of-the-question to consider a soft-deprecation of existing register_sidebar
functions in favor of newly-introduced equivalent register_widget_area
, etc. functions? It would need to be a conscious and agreed-upon effort, but I could definitely get behind "area" naming if that were an option.
In any case, I also agree that it needn't block merging this, especially as they're not exposed as part of a public interface (aside from the one class name).
lib/widgets-page.php
Outdated
@@ -29,6 +29,10 @@ function gutenberg_widgets_init( $hook ) { | |||
return; | |||
} | |||
|
|||
wp_add_inline_script( | |||
'wp-edit-widgets', | |||
'wp.editWidgets.initialize( "widgets-editor" )' |
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 should include a terminating semi-colon. Otherwise it may result in other wp_add_inline_script
for wp-edit-widgets
being treated as a continuation of this code, e.g. an IIFE would result in "VM662:2 Uncaught TypeError: wp.editWidgets.initialize(...) is not a function".
I observe local changes to |
I assume you meant (and had previously read this as) "now ready"... which has a very different meaning from a literal interpretation of the text 😄 |
I can't wait to see continued progress on this! It's looking good. 1. The background grey 2. Block widths 3. Some blocks should be excluded 4. Block toolbar 5. Block appender Let's remove the design feedback label for now since this is also being further discussed in the RFC. Once there's more to review, we can add the label back. |
Thanks for the great feedback @mapk
I also noticed that the block movers are not showing-up (not sure why yet). I'm going to merge this PR. there's a lot of work remaining here, but this should give us the basis from which we will be able to iterate all together. |
Related #13204
This PR bootstraps the widgets screen design:
This PR doesn't intent to solve all the issues related to this screen and is intended to land a first dumb screen in order to allow us to parallelize work and start tackling all the related issues.
Testing instructions
/wp-admin/admin.php?page=gutenberg-widgets