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

feat(TagOverflow): overflow tooltip variants #5249

Merged
merged 12 commits into from
May 28, 2024

Conversation

szinta
Copy link
Contributor

@szinta szinta commented May 16, 2024

Closes #4090

Support overflow content variants. Variants are "read-only tags" and "interactive tags."

What did you change?

  1. TagOverflowPopover and TagoverflowModal components updated to render read-only or interactive tags based on overflowType prop
  2. Alignment of both Additional content Popover and Truncation tooltip are set based on overflowAlign prop.
  3. Text wrap/truncation applied as per design recommendations

How did you test and verify your work?

Storybook

Copy link

netlify bot commented May 16, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit 1872e29
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/665565e1c5f3bd000982483a
😎 Deploy Preview https://deploy-preview-5249--carbon-for-ibm-products.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@szinta szinta changed the title feat(tagoverflow): overflow tooltip variants feat(TagOverflow): overflow tooltip variants May 16, 2024
@szinta szinta marked this pull request as ready for review May 21, 2024 06:43
@szinta szinta requested a review from a team as a code owner May 21, 2024 06:43
@szinta szinta requested review from elycheea, IgnacioBecerra and davidmenendez and removed request for a team May 21, 2024 06:43
Copy link
Contributor

@davidmenendez davidmenendez left a comment

Choose a reason for hiding this comment

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

looking good! just a few comments

@davidmenendez
Copy link
Contributor

additionally, this isn't specifically related to the PR, but i wanted to make a note of this. the getFilteredItems could be optimized using the array filter method. consider something like this:

const getFilteredItems = () => {
  if (open && search) {
    const filteredTags = allTags.filter((tag) => {
      return tag.label
        ?.toLocaleLowerCase()
        ?.includes(search.toLocaleLowerCase());
    });
    return filteredTags;
  }
  return allTags;
};

i didn't see data-search in the props anywhere, so i omitted it from this code haha. but yeah this code is slightly nicer because it doesn't rely on pushing items to other arrays. the filter method returns a shallow copy already!

@szinta
Copy link
Contributor Author

szinta commented May 23, 2024

additionally, this isn't specifically related to the PR, but i wanted to make a note of this. the getFilteredItems could be optimized using the array filter method. consider something like this:

const getFilteredItems = () => {
  if (open && search) {
    const filteredTags = allTags.filter((tag) => {
      return tag.label
        ?.toLocaleLowerCase()
        ?.includes(search.toLocaleLowerCase());
    });
    return filteredTags;
  }
  return allTags;
};

i didn't see data-search in the props anywhere, so i omitted it from this code haha. but yeah this code is slightly nicer because it doesn't rely on pushing items to other arrays. the filter method returns a shallow copy already!

Thanks for suggesting this optimisation. I have updated the code.

@szinta szinta requested a review from davidmenendez May 23, 2024 05:23
@amal-k-joy amal-k-joy added this pull request to the merge queue May 28, 2024
Merged via the queue into carbon-design-system:main with commit 022f8ff May 28, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include variants and content for tag overflow tooltips
3 participants