-
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
Components: promote ItemGroup
#33701
Conversation
Size Change: +468 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
…f `ItemGroup` are of the same type (fixes a CSS bug)
88726b5
to
edc4b16
Compare
edc4b16
to
a814b9d
Compare
<Item>Code is poetry</Item> | ||
</ItemGroup> | ||
); | ||
expect( wrapper ).toMatchSnapshot(); |
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 be wrapper.container.firstChild
expect( wrapper ).toMatchSnapshot(); | |
expect( wrapper.container.firstChild ).toMatchSnapshot(); |
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 1374e2a
(#33701)
/** | ||
* Renders borders around each items. | ||
* | ||
* @default false | ||
*/ | ||
isBordered?: boolean; |
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 just renders a border around the entire item group, no? It doesn't affect the items individually I don't think.
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.
As of now, isBordered
renders a border around the entire group and a border in between each item.
This also means that, is isBordered
is true
, changing the value of isSeparated
doesn't
cause any visual changes.
itemgroup-borders-separator.mp4
Should we change the behaviour of isBordered
so that it only renders a border around the whole group, and let isSeparated
show/hide borders in between each items?
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 actually went ahead in 4c23f28
(#33701) and changed the behaviour of isBordered
so that it only affects the border around the item-group (and not the separator in-between items).
Let me know if you find this new behaviour reasonable, or if I should revert back to how it was before
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 change the behaviour of
isBordered
so that it only renders a border around the whole group, and letisSeparated
show/hide borders in between each items?
Yeah! That makes sense!
* Renders items individually. Even if `isBordered` is `false`, a border | ||
* in between each item will be still be displayed. |
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.
If the above comment is true then this can be shorted to just Renders a separator between each item
.
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 like the new proposed description! Assuming the new behaviour for the isBordered
prop discussed above, I applied this change in 4c23f28
(#33701)
I also wanted to flag the changes made in |
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 good! Thank you @ciampo!
"title": "Item", | ||
"slug": "item", | ||
"markdown_source": "../packages/components/src/item-group/item/README.md", | ||
"parent": "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.
I wonder if this should be "parent": "item-group"
. But I'm not sure if this level of nesting actually works or is desirable in the Handbook. @gziolo Any thoughts?
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 structure in the handbook is rather flat for components. So I would leave it as is.
The other question is whether <Item />
really depends on the <ItemGroup />
. In other cases grouping is optional.
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.
Item
is quite dependant on ItemGroup
at the moment — for example, it reads the ItemGroup
context in order to derive values for the size
prop.
On its own, it's not very feature-full, nor opinionated in terms of styling. It really just is a div[role="listitem"]
which renders a div
or a button
depending on the isAction
prop.
Description
ItemGroup
andItem
components from thepackages/components/src/ui
folder to thepackages/components/src
folder[first|last]-of-type
selectors where causing an issue when mixing and matching different HTML element types (e.g. when one item hasisAction={true}
and the rest of the elements don't). To fix this bug, everyItem
is now wrapped in adiv
component to make sure that all children ofItemGroup
are of the same type@wordpress/components
packageHow has this been tested?
Screenshots
Types of changes
Refactor
Checklist:
*.native.js
files for terms that need renaming or removal).