Skip to content
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

Grafana UI: Add description to Menu component #77808

Merged
merged 8 commits into from
Nov 10, 2023

Conversation

axelavargas
Copy link
Member

@axelavargas axelavargas commented Nov 7, 2023

What is this feature?
Adds to the Menu component a new description option (majority of this code was taken from this PR by @gelicia

ItemMenuDescription.mp4

Why do we need this feature?

Users can benefit from more clarity in some complex menus.

Who is this feature for?

everyone

Which issue(s) does this PR fix?:

Fixes #

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@axelavargas axelavargas added add to changelog area/grafana/ui Issues that belong to components in the @grafana/ui library no-backport Skip backport of PR labels Nov 7, 2023
@axelavargas axelavargas added this to the 10.3.x milestone Nov 7, 2023
@axelavargas axelavargas self-assigned this Nov 7, 2023
@axelavargas axelavargas marked this pull request as ready for review November 8, 2023 13:46
@axelavargas axelavargas requested a review from a team as a code owner November 8, 2023 13:46
@axelavargas axelavargas requested review from tskarhed, JoaoSilvaGrafana, joshhunt and gelicia and removed request for a team November 8, 2023 13:46
@axelavargas axelavargas changed the title Grafana ui - Add description to menu item Grafana UI: Add description to Menu component Nov 8, 2023
@axelavargas axelavargas changed the title Grafana UI: Add description to Menu component Grafana UI: Add description to Menu component Nov 9, 2023
@axelavargas axelavargas changed the title Grafana UI: Add description to Menu component Grafana UI Add description to Menu component Nov 9, 2023
@axelavargas axelavargas changed the title Grafana UI Add description to Menu component Grafana UI: Add description to Menu component Nov 9, 2023
@@ -266,5 +305,13 @@ const getStyles = (theme: GrafanaTheme2) => {
color: theme.colors.text.secondary,
opacity: 0.7,
}),
description: css({
fontStyle: 'italic',
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it was in the other PR this came from, but we don't think the description should be italic. Otherwise, this looks good! 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, thanks for the heads up 🙌🏾 . I did the changes :)

Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

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

@axelavargas wanted to see if we could avoid adding the wrapping div, but didn't want to lump you with that so did some refactoring here: https://github.com/grafana/grafana/compare/axelav/add-description-to-menu...ash/menu-refactor?expand=1

i think this is the exact same behaviour you want just with a smaller amount of changes (and also fixes some weird things like negative margin on the icons 😬). if you're happy you can cherry-pick the commit 4afca39 onto your branch and it should cut down the diff a fair bit 👍

@axelavargas
Copy link
Member Author

@axelavargas wanted to see if we could avoid adding the wrapping div, but didn't want to lump you with that so did some refactoring here: axelav?expand=1 (compare)

i think this is the exact same behaviour you want just with a smaller amount of changes (and also fixes some weird things like negative margin on the icons 😬). if you're happy you can cherry-pick the commit 4afca39 onto your branch and it should cut down the diff a fair bit 👍

Thank you Mr Harrison 😎, the only thing with that approach is related to a11y, sometimes ItemElement can be a button or an a, and the Stack component is a div, this will make a11y fail :(

@ashharrison90
Copy link
Contributor

ashharrison90 commented Nov 9, 2023

@axelavargas wanted to see if we could avoid adding the wrapping div, but didn't want to lump you with that so did some refactoring here: axelav?expand=1 (compare)
i think this is the exact same behaviour you want just with a smaller amount of changes (and also fixes some weird things like negative margin on the icons 😬). if you're happy you can cherry-pick the commit 4afca39 onto your branch and it should cut down the diff a fair bit 👍

Thank you Mr Harrison 😎, the only thing with that approach is related to a11y, sometimes ItemElement can be a button or an a, and the Stack component is a div, this will make a11y fail :(

oh, does that fail a11y? 🤔 i thought you could nest a div inside 😅

if not, could we use a <span> instead of <Stack> with an appropriate class of something like:

css({
  display: 'flex',
  flexDirection: 'row',
  justifyContent: 'flex-start',
  alignItems: 'center',
})

@axelavargas
Copy link
Member Author

....
oh, does that fail a11y? 🤔 i thought you could nest a div inside 😅

if not, could we use a <span> instead of <Stack> with an appropriate class of something like:

css({
  display: 'flex',
  flexDirection: 'row',
  justifyContent: 'flex-start',
  alignItems: 'center',
})

Let me confirm again about a11y, now I am hesitating 😅

@axelavargas
Copy link
Member Author

@ashharrison90 alright, automation a11y tooling says it should be ok 😄 , I was mistaken. I will use the refactor, thanks a lot for helping with this 🥇

Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

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

lgtm 👏

@axelavargas axelavargas requested a review from a team as a code owner November 9, 2023 15:01
@axelavargas axelavargas requested review from dprokop and kaydelaney and removed request for a team November 9, 2023 15:01
@axelavargas axelavargas enabled auto-merge (squash) November 9, 2023 16:05
Copy link
Contributor

@joshhunt joshhunt left a comment

Choose a reason for hiding this comment

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

lgtm. nice team work 🙏

@axelavargas axelavargas merged commit 10269cb into main Nov 10, 2023
20 checks passed
@axelavargas axelavargas deleted the axelav/add-description-to-menu branch November 10, 2023 08:32
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/frontend area/grafana/ui Issues that belong to components in the @grafana/ui library no-backport Skip backport of PR
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants