-
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
Remove .components-item-group selector in edit-site components #67384
Remove .components-item-group selector in edit-site components #67384
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @im3dabasia! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thanks for the PR!
There are no strict rules, but in the Gutenberg project, many components define CSS class names based on the following rules:
{package-name}-{component-name|file-name}
This component is in the edit-site
package and the file name is sidebar-navigation-screen-main
, so an example of one CSS class name would be edit-site-sidebar-navigation-screen-main
.
I don't think we should include the components used inside the component (in this case the ItemGroup
component) in the CSS class name.
What do you think about these points?
Yes, I saw how the class names are given in the project. I appreciate your example, and I think the name you suggested is appropriate for our context. I will make the changes right away. |
I have made the changes as suggested. Please check now, @t-hamano. Let me know if there are any further changes. |
Thanks for the update! Sorry, I missed an important point. The NavigationPages
TemplatesPatternsFor this screen, the Can I use a similar approach to add class names to these components? 🙏 |
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.
Thanks for the update!
Everything works as expected, but it would be nice to improve the code quality a bit more.
Additionally, the latest trunk resolves some issues with mobile layouts. To be on the safe side, it would be a good idea to rebase this PR and retest 🙏
.edit-site-sidebar-dataviews { | ||
margin-left: -$grid-unit-20; | ||
margin-right: -$grid-unit-20; | ||
} |
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 element with this CSS class is a parent of the element with the .edit-site-sidebar-dataviews-dataview-item
class, so let's move this CSS here.
.edit-site-sidebar-navigation-screen-navigation-menus { | ||
margin-left: -$grid-unit-20; | ||
margin-right: -$grid-unit-20; | ||
} |
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.
Let's move this CSS class here as well.
packages/edit-site/src/style.scss
Outdated
@@ -35,6 +35,7 @@ | |||
@import "./components/pagination/style.scss"; | |||
@import "./components/global-styles/variations/style.scss"; | |||
@import "./components/sidebar-global-styles-wrapper/style.scss"; | |||
@import "./components/sidebar-navigation-screen-templates-browse/style.scss"; |
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.
Let's group the CSS related to the navigation screen together. Moving it here seems like a good place to start.
@@ -18,7 +18,7 @@ | |||
.edit-site-sidebar-navigation-screen__content { | |||
padding: 0 $grid-unit-20; | |||
|
|||
.components-item-group { | |||
.edit-site-sidebar-navigation-screen-main { |
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 create a new packages/edit-site/src/components/sidebar-navigation-screen-main/style.scss
file and move this style into it?
675da23
to
63999da
Compare
Fixes: #67369
What?
The
.components-item-group
selector has been replaced with a custom class (.edit-site-sidebar-navigation-screen__item-group
) that is scoped specifically to the sidebar navigation screen.This change does not affect other components outside of the sidebar navigation screen and will prevent unintended side effects if the
ItemGroup
component is used elsewhere in the future.Screenshot