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(announcement): add <rh-announcement> v2 #2153

Open
wants to merge 44 commits into
base: staging/cubone
Choose a base branch
from

Conversation

adamjohnson
Copy link
Collaborator

@adamjohnson adamjohnson commented Feb 3, 2025

What I did

  1. Moved <rh-announcement> to a new PR because the old PR (feat(announcement): add <rh-announcement> #1722) had so many merge conflicts.
  2. Created <rh-announcement>. See the Figma file.
  3. Changed imgleft boolean attribute to image-position="inline-start".
  4. Added a lightdom.css file for decreased FOUC

Testing Instructions

  1. Be sure to get up to speed on all the previous work done in feat(announcement): add <rh-announcement> #1722
  2. View each of the demos in the DP:
  3. Compare demos to be sure they match the Figma
  4. Make sure everything is accessible
  5. Make sure this component can be customized as needed
  6. Slot in a real image, text, and CTA
  7. Test with lots of / too much content in the body slot

Notes to Reviewers

Closes #1576.

To do's

  • Docs

@adamjohnson adamjohnson added this to the 2025/Q1 — Cubone release milestone Feb 3, 2025
@adamjohnson adamjohnson self-assigned this Feb 3, 2025
Copy link

changeset-bot bot commented Feb 3, 2025

🦋 Changeset detected

Latest commit: 0edd9e0

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 Minor

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 Feb 3, 2025

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

Name Link
🔨 Latest commit 0edd9e0
🔍 Latest deploy log https://app.netlify.com/sites/red-hat-design-system/deploys/67aa6a4b8c5c6c00085be1c6
😎 Deploy Preview https://deploy-preview-2153--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 Feb 3, 2025

Size Change: +2.38 kB (+1.15%)

Total Size: 209 kB

Filename Size Change
./elements.js 482 B +9 B (+1.9%)
./elements/rh-announcement/rh-announcement.js 2.19 kB +2.19 kB (new file) 🆕
./react/rh-announcement/rh-announcement.js 189 B +189 B (new file) 🆕
ℹ️ View Unchanged
Filename Size
./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.85 kB
./elements/rh-back-to-top/rh-back-to-top.js 1.94 kB
./elements/rh-badge/rh-badge.js 1.55 kB
./elements/rh-blockquote/rh-blockquote.js 1.43 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.96 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 964 B
./elements/rh-footer/rh-footer-universal.js 3.99 kB
./elements/rh-footer/rh-footer.js 4.96 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.41 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.13 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-tile/rh-tile.js 5.09 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 679 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

@alypilkons alypilkons self-requested a review February 3, 2025 20:55
@adamjohnson adamjohnson marked this pull request as ready for review February 3, 2025 20:56
@dmazon-redhat
Copy link

Comments from my review of the demos. Thanks Adam for sharing!

Spacing adjustments

Announcement documentation spacing for reference:

Screenshot 2025-02-04 at 9 14 18 PM

Space between the image and paragraph text should be 32px on desktop instead of 24px.

Screenshot 2025-02-04 at 9 13 59 PM

I noticed that there is extra margin of 32px on the right hand side after the default CTA which slightly makes the content not centered. This could be removed at a desktop size but we will want to make sure that at all breakpoint sizes there is at least a 16px buffer between the CTA / paragraph text and the close button.

Screenshot 2025-02-04 at 9 16 12 PM

The 32px margin on the right really impacts the mobile size as seen below. We can free up at least 16px of space to give the content some more room to stretch out.

Screenshot 2025-02-04 at 9 19 57 PM

Maybe applying 16px to the close button instead of the end of the CTA would cover the needed right spacing of 16px at mobile sizes

Screenshot 2025-02-04 at 9 24 46 PM

Close button touch target

This might not be an issue but wanted to inquire about the touch target size for the close button. Does it at minimum meet the required 24x24px target size? When I look at the focus size it shows 16x16px Just trying to meet our accessibility standards for a really small icon that has a big ol' functional purpose for users.
Screenshot 2025-02-04 at 9 31 16 PM

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.

  • Should be there be space between the content and the close button? (cc @dmazon-redhat)
    Screenshot 2025-02-05 at 4 01 24 PM

  • I noticed that the dark color palettes all have the overriding dark-alt surface color. Should the light color palettes all use the lightest surface color?
    Screenshot 2025-02-05 at 3 50 11 PM

@adamjohnson
Copy link
Collaborator Author

Made some spacing adjustments. PTAL.

I noticed that the dark color palettes all have the overriding dark-alt surface color. Should the light color palettes all use the lightest surface color?

@dmazon-redhat let me know if this change needs made. TY!

@adamjohnson
Copy link
Collaborator Author

FYI docs are now up. PTAL.

I have the personalization/implementation docs coded but stashed on my local computer while we confirm they are okay to make public.

Copy link
Member

@bennypowers bennypowers left a comment

Choose a reason for hiding this comment

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

overall looks very clean. almost all my comments here are nits, but please do expand on the tests and see if we can remove dark-alt

.changeset/proud-trees-exercise.md Outdated Show resolved Hide resolved
elements/rh-announcement/README.md Outdated Show resolved Hide resolved
elements/rh-announcement/demo/color-context.html Outdated Show resolved Hide resolved
elements/rh-announcement/demo/color-context.html Outdated Show resolved Hide resolved
elements/rh-announcement/README.md Outdated Show resolved Hide resolved
elements/rh-announcement/demo/rh-announcement.html Outdated Show resolved Hide resolved
elements/rh-announcement/rh-announcement-lightdom.css Outdated Show resolved Hide resolved
elements/rh-announcement/rh-announcement-lightdom.css Outdated Show resolved Hide resolved
text-align: center;

&.dark {
--rh-color-surface: var(--rh-color-surface-dark-alt, #292929);
Copy link
Member

Choose a reason for hiding this comment

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

can we avoid dark-alt? it's kind of a footgun in our theming system

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This question is likely best answered by @dmazon-redhat. Is it possible to have announcement follow our theming system's colors as follows?

  • Dark 👉 var(--rh-color-surface-dark, #383838)
  • Darker 👉 var(--rh-color-surface-darker, #1f1f1f)
  • Darkest 👉 var(--rh-color-surface-darkest, #151515)

See this video demonstrating what those colors look like in action.

Most (all?) of our components follow these conventions. If necessary, users can customize this via something like:

rh-announcement[color-palette="darker"] { --rh-color-surface: powderblue; }

@bennypowers LMK if you have ideas/direction about this via color transformations (color-mix?).

Copy link
Member

@bennypowers bennypowers Feb 11, 2025

Choose a reason for hiding this comment

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

maybe something like this:

#container {
  background: var(--rh-color-surface);
  &.dark {
    background: oklch(from var(--rh-color-surface) calc(l + 10%) c h);
  }
}

https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch

elements/rh-announcement/test/rh-announcement.spec.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review 🔍
Development

Successfully merging this pull request may close these issues.

4 participants