Skip to content

feat(Label): add button for adding new labels#4828

Merged
mcoker merged 4 commits into
patternfly:mainfrom
thatblindgeye:labelGroup_add-label
May 4, 2022
Merged

feat(Label): add button for adding new labels#4828
mcoker merged 4 commits into
patternfly:mainfrom
thatblindgeye:labelGroup_add-label

Conversation

@thatblindgeye

@thatblindgeye thatblindgeye commented May 3, 2022

Copy link
Copy Markdown
Contributor

Closes #4756

Convenience links:

Label componeont
LabelGroup component

This PR:

  • Adds a parameter for an add label
  • Adjusts the CSS so that the add label shares the same styles with the overflow button (per convo with Matt and Margot)
  • Adds simple examples of what the add label would look like in both the Label and LableGroup components

One thing to consider with how I updated the CSS is that within the Label page, the variables aren't exposed below the doc table for the pf-m-add selector, and within the CSS itself this selector is also using variables with "overflow" in their name. I believe an alternative would be to copy+paste any styles for the overflow and change them to reflect this add label ( --pf-c-label--m-add__content--Color and so on). Since the overflow and add labels are both assumed to always share the same styles, though, I'm wondering whether if at some point down the line these variables would be updated to be less specific to the overflow (though this still doesn't resolve this possible issue in the present)?

@patternfly-build

patternfly-build commented May 3, 2022

Copy link
Copy Markdown
Collaborator

@mcarrano mcarrano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good @thatblindgeye . Do you think we need an example that shows the Add label and overflow buttons existing together? Not sure, but wanted to raise the question.

@thatblindgeye

Copy link
Copy Markdown
Contributor Author

@mcarrano I'm not sure if such an example is needed, but I also wouldn't be opposed to adding one in just to show how both might look co-existing with one another. @mcoker what are your thoughts?

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great job @thatblindgeye!!! Just a few nits, and we discussed that the add button should (probably?) not be part of the label group list as it isn't an item in the group list - it's more like a control for the group. This will be inline with the add button we recently added to tabs, too.

Comment thread src/patternfly/components/Label/examples/Label.md Outdated
Comment thread src/patternfly/components/Label/examples/Label.md Outdated
@@ -1,4 +1,4 @@
<{{# if label--type}}{{label--type}}{{else if label--IsOverflow}}button{{else}}span{{/if}} class="pf-c-label{{#if label--IsOverflow}} pf-m-overflow{{/if}}{{#if label--modifier}} {{label--modifier}}{{/if}}{{#if label--IsEditable}} pf-m-editable{{/if}}{{#if label--IsEditableActive}} pf-m-editable-active{{/if}}"
<{{# if label--type}}{{label--type}}{{else if label--IsOverflow}}button{{else if label--IsAdd}}button{{else}}span{{/if}} class="pf-c-label{{#if label--IsOverflow}} pf-m-overflow{{/if}}{{#if label--IsAdd}} pf-m-add{{/if}}{{#if label--modifier}} {{label--modifier}}{{/if}}{{#if label--IsEditable}} pf-m-editable{{/if}}{{#if label--IsEditableActive}} pf-m-editable-active{{/if}}"
{{#if label--attribute}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this label is missing type="button" when it's a <button> element (default is type="submit" which we don't want). Could you add a conditional in here that tests for IsOverflow/Add and adds type="button"?

@thatblindgeye thatblindgeye force-pushed the labelGroup_add-label branch from d3c61c6 to 5a32fa7 Compare May 4, 2022 21:03
@thatblindgeye

Copy link
Copy Markdown
Contributor Author

Really great job @thatblindgeye!!! Just a few nits, and we discussed that the add button should (probably?) not be part of the label group list as it isn't an item in the group list - it's more like a control for the group. This will be inline with the add button we recently added to tabs, too.

@mcoker As mentioned in our convo, I'm leaning towards this being something for next milestone possibly? I know it was mentioned when we sat to discuss this that getting the add button to be more inline but also outside the label group list might be tricky, so it may just require a little more research/discussion.

@thatblindgeye thatblindgeye requested a review from mcoker May 4, 2022 21:16

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! Great work!! 🤩

@mcarrano mcarrano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks @thatblindgeye !

@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 4.193.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Label Group] - editable label group

4 participants