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

fix(tile): compact link icon layout #2082

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

bennypowers
Copy link
Member

@bennypowers bennypowers commented Dec 9, 2024

What I did

  1. fix layouts for <rh-tile compact> when there is a link and an icon
  2. add demo files to illustrate the pattern

Testing Instructions

  1. check out the new compact-link-with-icon demo (and othersj., ensure it conforms to figma specs

Notes to Reviewers

We might want to implement other patterns from the figma here, like compact with image and icon, different sized icons, etc. See figma

Thanks @tejas161 for reporting this issue

Copy link

changeset-bot bot commented Dec 9, 2024

🦋 Changeset detected

Latest commit: 56d8433

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rhds/elements Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Dec 9, 2024

Deploy Preview for red-hat-design-system ready!

Name Link
🔨 Latest commit 56d8433
🔍 Latest deploy log https://app.netlify.com/sites/red-hat-design-system/deploys/67c03f54dddd170008c50316
😎 Deploy Preview https://deploy-preview-2082--red-hat-design-system.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.

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Size Change: -149 B (-0.07%)

Total Size: 207 kB

Filename Size Change
./elements/rh-tile/rh-tile.js 4.93 kB -149 B (-2.93%)
ℹ️ View Unchanged
Filename Size
./elements.js 473 B
./elements/rh-accordion/context.js 162 B
./elements/rh-accordion/rh-accordion-header.js 2.69 kB
./elements/rh-accordion/rh-accordion-panel.js 1.35 kB
./elements/rh-accordion/rh-accordion.js 3.21 kB
./elements/rh-alert/rh-alert.js 4.26 kB
./elements/rh-audio-player/rh-audio-player-about.js 1.8 kB
./elements/rh-audio-player/rh-audio-player-rate-stepper.js 1.85 kB
./elements/rh-audio-player/rh-audio-player-scrolling-text-overflow.js 1.53 kB
./elements/rh-audio-player/rh-audio-player-subscribe.js 1.38 kB
./elements/rh-audio-player/rh-audio-player.js 13.1 kB
./elements/rh-audio-player/rh-cue.js 1.95 kB
./elements/rh-audio-player/rh-transcript.js 2.7 kB
./elements/rh-avatar/random-pattern-controller.js 2.72 kB
./elements/rh-avatar/rh-avatar.js 2.86 kB
./elements/rh-back-to-top/rh-back-to-top.js 2.1 kB
./elements/rh-badge/rh-badge.js 1.55 kB
./elements/rh-blockquote/rh-blockquote.js 1.36 kB
./elements/rh-breadcrumb/rh-breadcrumb.js 1.5 kB
./elements/rh-button/rh-button.js 4.24 kB
./elements/rh-card/rh-card.js 3.58 kB
./elements/rh-code-block/prism.css.js 667 B
./elements/rh-code-block/prism.js 572 B
./elements/rh-code-block/rh-code-block.js 7.34 kB
./elements/rh-cta/rh-cta.js 4.04 kB
./elements/rh-dialog/rh-dialog.js 4.78 kB
./elements/rh-dialog/yt-api.js 617 B
./elements/rh-footer/rh-footer-block.js 714 B
./elements/rh-footer/rh-footer-copyright.js 362 B
./elements/rh-footer/rh-footer-links.js 1.17 kB
./elements/rh-footer/rh-footer-social-link.js 1.15 kB
./elements/rh-footer/rh-footer-universal.js 4.04 kB
./elements/rh-footer/rh-footer.js 5 kB
./elements/rh-health-index/rh-health-index.js 2.35 kB
./elements/rh-icon/rh-icon.js 2.47 kB
./elements/rh-icon/ssr.js 181 B
./elements/rh-menu/rh-menu.js 1.29 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-dropdown.js 2.47 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-menu-section.js 1.3 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-menu.js 1.75 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-overlay.js 571 B
./elements/rh-navigation-secondary/rh-navigation-secondary.js 5.26 kB
./elements/rh-navigation-secondary/test/fixtures.js 769 B
./elements/rh-pagination/rh-pagination.js 5.4 kB
./elements/rh-site-status/rh-site-status.js 2.5 kB
./elements/rh-skip-link/rh-skip-link.js 1.19 kB
./elements/rh-spinner/rh-spinner.js 1.38 kB
./elements/rh-stat/rh-stat.js 2.12 kB
./elements/rh-subnav/rh-subnav.js 2.73 kB
./elements/rh-surface/rh-surface.js 1.14 kB
./elements/rh-surface/test/elements.js 423 B
./elements/rh-switch/rh-switch.js 2.93 kB
./elements/rh-table/rh-sort-button.js 1.49 kB
./elements/rh-table/rh-table.js 3.48 kB
./elements/rh-tabs/context.js 160 B
./elements/rh-tabs/rh-tab-panel.js 1.04 kB
./elements/rh-tabs/rh-tab.js 3.02 kB
./elements/rh-tabs/rh-tabs.js 3.77 kB
./elements/rh-tag/rh-tag.js 2.79 kB
./elements/rh-tile/rh-tile-group.js 1.81 kB
./elements/rh-timestamp/rh-timestamp.js 983 B
./elements/rh-tooltip/rh-tooltip.js 2.73 kB
./elements/rh-video-embed/rh-video-embed.js 4.59 kB
./lib/context/color/consumer.js 1.41 kB
./lib/context/color/controller.js 947 B
./lib/context/color/provider.js 2.18 kB
./lib/context/event.js 593 B
./lib/context/headings/consumer.js 722 B
./lib/context/headings/controller.js 1.12 kB
./lib/context/headings/provider.js 1.24 kB
./lib/DirController.js 565 B
./lib/elements/rh-context-demo/rh-context-demo.js 1.28 kB
./lib/elements/rh-context-picker/rh-context-picker.js 2.24 kB
./lib/environment.js 194 B
./lib/functions.js 175 B
./lib/I18nController.js 1.38 kB
./lib/ScreenSizeController.js 849 B
./lib/ssr-controller.js 251 B
./react/rh-accordion/rh-accordion-header.js 199 B
./react/rh-accordion/rh-accordion-panel.js 185 B
./react/rh-accordion/rh-accordion.js 215 B
./react/rh-alert/rh-alert.js 184 B
./react/rh-audio-player/rh-audio-player-about.js 191 B
./react/rh-audio-player/rh-audio-player-rate-stepper.js 213 B
./react/rh-audio-player/rh-audio-player-scrolling-text-overflow.js 214 B
./react/rh-audio-player/rh-audio-player-subscribe.js 196 B
./react/rh-audio-player/rh-audio-player.js 183 B
./react/rh-audio-player/rh-cue.js 195 B
./react/rh-audio-player/rh-transcript.js 207 B
./react/rh-avatar/rh-avatar.js 173 B
./react/rh-back-to-top/rh-back-to-top.js 183 B
./react/rh-badge/rh-badge.js 174 B
./react/rh-blockquote/rh-blockquote.js 179 B
./react/rh-breadcrumb/rh-breadcrumb.js 179 B
./react/rh-button/rh-button.js 174 B
./react/rh-card/rh-card.js 172 B
./react/rh-code-block/rh-code-block.js 181 B
./react/rh-cta/rh-cta.js 170 B
./react/rh-dialog/rh-dialog.js 203 B
./react/rh-footer/rh-footer-block.js 184 B
./react/rh-footer/rh-footer-copyright.js 187 B
./react/rh-footer/rh-footer-links.js 185 B
./react/rh-footer/rh-footer-social-link.js 193 B
./react/rh-footer/rh-footer-universal.js 188 B
./react/rh-footer/rh-footer.js 174 B
./react/rh-health-index/rh-health-index.js 184 B
./react/rh-icon/rh-icon.js 202 B
./react/rh-menu/rh-menu.js 173 B
./react/rh-navigation-secondary/rh-navigation-secondary-dropdown.js 217 B
./react/rh-navigation-secondary/rh-navigation-secondary-menu-section.js 205 B
./react/rh-navigation-secondary/rh-navigation-secondary-menu.js 199 B
./react/rh-navigation-secondary/rh-navigation-secondary-overlay.js 201 B
./react/rh-navigation-secondary/rh-navigation-secondary.js 213 B
./react/rh-pagination/rh-pagination.js 178 B
./react/rh-site-status/rh-site-status.js 181 B
./react/rh-skip-link/rh-skip-link.js 181 B
./react/rh-spinner/rh-spinner.js 175 B
./react/rh-stat/rh-stat.js 171 B
./react/rh-subnav/rh-subnav.js 175 B
./react/rh-surface/rh-surface.js 175 B
./react/rh-switch/rh-switch.js 185 B
./react/rh-table/rh-sort-button.js 213 B
./react/rh-table/rh-table.js 174 B
./react/rh-tabs/rh-tab-panel.js 181 B
./react/rh-tabs/rh-tab.js 187 B
./react/rh-tabs/rh-tabs.js 174 B
./react/rh-tag/rh-tag.js 182 B
./react/rh-tile/rh-tile-group.js 183 B
./react/rh-tile/rh-tile.js 194 B
./react/rh-timestamp/rh-timestamp.js 176 B
./react/rh-tooltip/rh-tooltip.js 175 B
./react/rh-video-embed/rh-video-embed.js 227 B
./uxdot/uxdot-best-practice.js 742 B
./uxdot/uxdot-copy-button.js 1.2 kB
./uxdot/uxdot-copy-permalink.js 1.1 kB
./uxdot/uxdot-example.js 1.17 kB
./uxdot/uxdot-feedback.js 727 B
./uxdot/uxdot-header.js 1.07 kB
./uxdot/uxdot-hero.js 680 B
./uxdot/uxdot-installation-tabs.js 675 B
./uxdot/uxdot-masthead.js 809 B
./uxdot/uxdot-pattern-ssr-controller-client.js 604 B
./uxdot/uxdot-pattern-ssr-controller-server.js 1.68 kB
./uxdot/uxdot-pattern-ssr-controller.js 213 B
./uxdot/uxdot-pattern.js 2.12 kB
./uxdot/uxdot-repo-status-checklist.js 1.16 kB
./uxdot/uxdot-repo-status-list.js 1.07 kB
./uxdot/uxdot-repo-status-table.js 782 B
./uxdot/uxdot-repo.js 1.17 kB
./uxdot/uxdot-search.js 2.39 kB
./uxdot/uxdot-sidenav.js 2.67 kB
./uxdot/uxdot-spacer-tokens-table.js 2.45 kB
./uxdot/uxdot-toc.js 1.13 kB

compressed-size-action

@markcaron
Copy link
Collaborator

@bennypowers I think we need to update many of the demos. There doesn't seem to be an example of both compact and an icon in the icon slot (or the use of the icon attr). On the compact demo, there's an icon, but it's confusingly just part of the body slot.

@markcaron markcaron added the bug Something isn't working label Dec 9, 2024
Copy link
Collaborator

@marionnegp marionnegp left a comment

Choose a reason for hiding this comment

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

  • Just for the prettiness of the demo, can you fix the broken icon in the color context and compact demos?

Screenshot 2024-12-10 at 12 23 52 PM

  • Probably nitpicky, but can the blue icons in the icon demo and the link types demo use --rh-color-icon-primary-on-light instead?

  • For the default size tile, the space between an icon and a title should be --rh-space-2xl. Currently looks like there's no space in the icon demo
    Screenshot 2024-12-10 at 1 37 09 PM

  • In selectable tile, the required slot is the header, so in the form control demo I'd just move the placeholder text that's in the body.
    Screenshot 2024-12-10 at 1 38 25 PM

@bennypowers
Copy link
Member Author

for the icon and link-types demo, where the icon attribute is used, the color for the icon is defined as --rh-tile-interactive-color. Meaning: until now it's assumed that the icon colour should always match the link arrow / other interactive elements (see screenshot). Was it your intention to provide a new icon color css custom property for tile? That would require a minor release (i.e. @rhds/elements version 2.2.0), or is it sufficient that if users want to customize the icon colour without changing the interactive colour, they can slot in their own icon?

image

@bennypowers
Copy link
Member Author

bennypowers commented Dec 11, 2024

Regarding the form control demo, I believe the guidelines docs are out of date. They state:

Writing content

The four content slots within a tile are title, heading, body, and footer.

Slot Content
Title A title provides secondary descriptive context. A selectable tile does not have title slots.
Heading In a link tile, the heading should indicate what clicking on the tile will do. In a selectable tile, the heading labels the radio button or checkbox.
Body The body text expands on heading content and gives the user more information.
Footer Footer text should be brief and be used for supplementary information only.

however in the element definition, we have

/**
 * @slot image - optional image on top of tile
 * @slot icon - optional icon
 * @slot title - optional title
 * @slot headline - optional headline / link title
 * @slot - optional body content
 * @slot footer - optional footer
 */

which accurately lists the available slots, but does not document their use and purpose as well as the guidelines pages.

So there's a mismatch here that needs to be addressed.

I attempted to resolve this by copying the guidelines text into the jsdoc, slightly modified (since compact tiles also don't have title slots). I also changed the guidelines page to refer to headline instead of heading


I think this points to a more pervasive issue, being the disconnect between developer-focused "code" api docs and designer-focused guideline docs.

@bennypowers
Copy link
Member Author

Regarding selectable tile content in the demos: i wrapped the content in headline slots. we might want to add corresponding attribute pairs for cubone (in another pr):

Before

<rh-tile-group radio>
  <rh-tile name="radio" value="1"><span slot="headline">Radio 1</span></rh-tile>
  <rh-tile name="radio" value="2"><span slot="headline">Radio 2</span></rh-tile>
</rh-tile-group>
<rh-tile-group checkable>
  <rh-tile name="check" value="1"><span slot="headline">Check 1</span></rh-tile>
  <rh-tile name="check" value="2"><span slot="headline">Check 2</span></rh-tile>
</rh-tile-group>

After:

<rh-tile-group radio>
  <rh-tile name="radio" value="1" headline="Radio 1"></rh-tile>
  <rh-tile name="radio" value="2" headline="Radio 2"></rh-tile>
</rh-tile-group>
<rh-tile-group checkable>
  <rh-tile name="check" value="1" headline="Check 1"></rh-tile>
  <rh-tile name="check" value="2" headline="Check 2"></rh-tile>
</rh-tile-group>

@bennypowers bennypowers enabled auto-merge (squash) December 11, 2024 13:04
@bennypowers
Copy link
Member Author

Layouts here appear to be broken, will have to fix them before merging

@bennypowers bennypowers disabled auto-merge January 6, 2025 15:55
Copy link
Collaborator

@marionnegp marionnegp left a comment

Choose a reason for hiding this comment

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

Placement of the icon in compact tiles looks good!

  • Is the icon in this tile (seen in color context demo) showing how to add an icon inline with the body text?

  • For the regular tiles with an icon, I'm seeing a 55px height instead of the expected 48px (based on the icon size). It's making the space between the icon and title look too big. Would a max-height for the icon slot help here?
    Screenshot 2025-02-18 at 2 16 17 PM

@bennypowers
Copy link
Member Author

bennypowers commented Feb 19, 2025

Is the icon in this tile (seen in color context demo) showing how to add an icon inline with the body text?

I'm not sure what you're referring to, there are 27(!) example tiles in that file. Can you be more specific, please?

For the regular tiles with an icon, I'm seeing a 55px height instead of the expected 48px (based on the icon size). It's making the space between the icon and title look too big. Would a max-height for the icon slot help here?

Is that an issue of demo content? after merging in main I believe this issue is resolved: https://deploy-preview-2082--red-hat-design-system.netlify.app/elements/tile/demo/desaturated-heading/

@marionnegp
Copy link
Collaborator

Is the icon in this tile (seen in color context demo) showing how to add an icon inline with the body text?

I'm not sure what you're referring to, there are 27(!) example tiles in that file. Can you be more specific, please?

Argh, I think I meant to add a screenshot. It's this one:
Screenshot 2025-02-26 at 8 40 26 PM

@marionnegp
Copy link
Collaborator

For the regular tiles with an icon, I'm seeing a 55px height instead of the expected 48px (based on the icon size). It's making the space between the icon and title look too big. Would a max-height for the icon slot help here?

Is that an issue of demo content? after merging in main I believe this issue is resolved: https://deploy-preview-2082--red-hat-design-system.netlify.app/elements/tile/demo/desaturated-heading/

It seems like the height is different depending on whether you're looking at the icon slot under shadow-root or not.

shadow DOM
Screenshot 2025-02-26 at 8 43 38 PM

light DOM
Screenshot 2025-02-26 at 8 43 50 PM

@bennypowers
Copy link
Member Author

Is the icon in this tile (seen in color context demo) showing how to add an icon inline with the body text?

I'm not sure what you're referring to, there are 27(!) example tiles in that file. Can you be more specific, please?

Argh, I think I meant to add a screenshot. It's this one: Screenshot 2025-02-26 at 8 40 26 PM

seems likely to me this was an oversight - i added the slot=icon attribute to that icon; likewise to the 4th example under "compact"

@bennypowers
Copy link
Member Author

bennypowers commented Feb 27, 2025

For the regular tiles with an icon, I'm seeing a 55px height instead of the expected 48px (based on the icon size). It's making the space between the icon and title look too big. Would a max-height for the icon slot help here?

Is that an issue of demo content? after merging in main I believe this issue is resolved: https://deploy-preview-2082--red-hat-design-system.netlify.app/elements/tile/demo/desaturated-heading/

It seems like the height is different depending on whether you're looking at the icon slot under shadow-root or not.

shadow DOM Screenshot 2025-02-26 at 8 43 38 PM

light DOM Screenshot 2025-02-26 at 8 43 50 PM
image

See above, the icons and title line up on screen. I believe the discrepancy you're noticing is between the slotted svg element and the slot element it projects into, which have different styles.

@bennypowers
Copy link
Member Author

bennypowers commented Feb 27, 2025

Probably nitpicky, but can the blue icons in the icon demo and the link types demo use --rh-color-icon-primary-on-light instead?

@marionnegp This still needs design clarification: is the icon always supposed to have --rh-color-icon-primary color, or is it meant to use the interactive color (as it does now). It's not trivial to change to icon-primary, or to default to icon-primary when an interactive color is not set: what happens in focus or hover state? Does the icon change to the focus/hover interactive color, then back to icon-primary? in the case where the user does set the interactive colour, does the icon remain icon-primary, or does it take on the user-defined interactive color?

see #2082 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Review 🔍
Development

Successfully merging this pull request may close these issues.

[bug] <rh-tile> Icon displays differently between slot="icon" and the host's icon attribute
3 participants