Skip to content

feat(Hero): glass styling update#12412

Merged
mcoker merged 3 commits intopatternfly:mainfrom
kmcfaul:hero-updates
May 8, 2026
Merged

feat(Hero): glass styling update#12412
mcoker merged 3 commits intopatternfly:mainfrom
kmcfaul:hero-updates

Conversation

@kmcfaul
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul commented May 7, 2026

What: Closes #12413

Additional issues:

Summary by CodeRabbit

  • New Features

    • Hero component gains an optional "glass" visual style (opt-in prop) with default off.
  • Tests

    • Updated tests to verify default styling and conditional glass styling behavior.
  • Chores

    • Aligned design system/dev tooling across packages to keep styling and tokens consistent.
  • Docs / Demos

    • Demo updated to showcase the Hero glass usage in multi-line child form.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 81367a80-5cbc-4543-b6ce-548f0af61e72

📥 Commits

Reviewing files that changed from the base of the PR and between c45bed8 and e135731.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • packages/react-core/package.json
  • packages/react-core/src/components/Hero/Hero.tsx
  • packages/react-core/src/components/Hero/__tests__/Hero.test.tsx
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-tokens/package.json
✅ Files skipped from review due to trivial changes (4)
  • packages/react-styles/package.json
  • packages/react-core/package.json
  • packages/react-tokens/package.json
  • packages/react-docs/package.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/react-icons/package.json
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
  • packages/react-core/src/components/Hero/tests/Hero.test.tsx
  • packages/react-core/src/components/Hero/Hero.tsx

Walkthrough

Replaces Hero's hasNoGlass prop with isGlass (default false), updates PatternFly dependency to 6.5.0-prerelease.82 across packages, and updates tests and a demo to verify the glass modifier behavior.

Changes

Hero Component Glass Prop Migration

Layer / File(s) Summary
Dependency Updates
packages/react-core/package.json, packages/react-docs/package.json, packages/react-icons/package.json, packages/react-styles/package.json, packages/react-tokens/package.json
@patternfly/patternfly version bumped from 6.5.0-prerelease.80 to 6.5.0-prerelease.82.
Hero Props API
packages/react-core/src/components/Hero/Hero.tsx
HeroProps removes hasNoGlass?: boolean and adds isGlass?: boolean (default false).
Hero Implementation
packages/react-core/src/components/Hero/Hero.tsx
Destructuring default changed from hasNoGlass = false to isGlass = false; wrapper className now applies styles.modifiers.glass when isGlass is true instead of toggling styles.modifiers.noGlass.
Tests & Demo
packages/react-core/src/components/Hero/__tests__/Hero.test.tsx, packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
Tests updated to assert default styles.hero and conditional styles.modifiers.glass; demo updated to pass isGlass and render child text on its own line.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Demo
  participant Hero
  participant Test
  Demo->>Hero: render Hero (with/without isGlass)
  Hero->>Test: DOM contains styles.hero and optionally styles.modifiers.glass
Loading

Suggested reviewers

  • mcoker
  • thatblindgeye
  • nicolethoen
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(Hero): glass styling update' clearly summarizes the main change—updating the Hero component's glass styling implementation, which aligns with the changeset modifications to the Hero component and related test files.
Linked Issues check ✅ Passed The PR implements the React-side updates to Hero component's glass styling as required by #12413, replacing the old hasNoGlass prop with the new isGlass prop and updating test coverage accordingly.
Out of Scope Changes check ✅ Passed All changes are in scope: Hero component glass styling updates (#12413), related test updates, demo updates, and consistent PatternFly dependency version bumps across packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kmcfaul kmcfaul linked an issue May 7, 2026 that may be closed by this pull request
@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented May 7, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/react-core/src/components/Hero/Hero.tsx (1)

37-38: ⚡ Quick win

Consider a temporary compatibility bridge for the removed hasNoGlass prop.

Dropping hasNoGlass outright introduces a breaking API change for existing consumers. A short deprecation window (accept both props, prefer isGlass) would reduce upgrade friction.

Proposed compatibility diff
 export interface HeroProps extends Omit<React.HTMLProps<HTMLDivElement>, 'content'> {
@@
   /** Flag indicating the hero has glass styling when glass theme is applied. */
   isGlass?: boolean;
+  /** `@deprecated` Use `isGlass` instead. */
+  hasNoGlass?: boolean;
@@
 export const Hero: React.FunctionComponent<HeroProps> = ({
@@
-  isGlass = false,
+  isGlass,
+  hasNoGlass,
@@
 }) => {
+  const useGlass = isGlass ?? (hasNoGlass !== undefined ? !hasNoGlass : false);
@@
-      className={css(styles.hero, isGlass && styles.modifiers.glass, className)}
+      className={css(styles.hero, useGlass && styles.modifiers.glass, className)}

Also applies to: 52-53, 93-93

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-core/src/components/Hero/Hero.tsx` around lines 37 - 38, Hero
component removed the legacy hasNoGlass prop causing a breaking change; add a
temporary compatibility bridge by accepting an optional hasNoGlass?: boolean in
the Hero props and mapping it to the new isGlass boolean when isGlass is
undefined (i.e., derive isGlass = props.isGlass ?? !props.hasNoGlass). Emit a
single deprecation warning (console.warn) when hasNoGlass is provided, prefer
isGlass in all internal checks (e.g., inside the Hero render logic and any
helper functions referenced in this file), and keep the public type including
hasNoGlass as deprecated so consumers have a short migration window.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/react-core/src/components/Hero/__tests__/Hero.test.tsx`:
- Around line 25-41: The tests for the Hero component use toHaveClass with {
exact: true } against the parent element which also contains the base hero
class; update the three test cases that reference styles.modifiers.glass (the
tests whose titles include "Renders with ... class when isGlass is true",
"Renders without ... class when isGlass is false", and "Renders without ...
class by default") to call toHaveClass(styles.modifiers.glass) and
.not.toHaveClass(styles.modifiers.glass) without the { exact: true } option so
the assertions check for the presence/absence of the modifier class rather than
an exact class list.

---

Nitpick comments:
In `@packages/react-core/src/components/Hero/Hero.tsx`:
- Around line 37-38: Hero component removed the legacy hasNoGlass prop causing a
breaking change; add a temporary compatibility bridge by accepting an optional
hasNoGlass?: boolean in the Hero props and mapping it to the new isGlass boolean
when isGlass is undefined (i.e., derive isGlass = props.isGlass ??
!props.hasNoGlass). Emit a single deprecation warning (console.warn) when
hasNoGlass is provided, prefer isGlass in all internal checks (e.g., inside the
Hero render logic and any helper functions referenced in this file), and keep
the public type including hasNoGlass as deprecated so consumers have a short
migration window.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28925f87-e424-41d6-baca-e1b666eb61c9

📥 Commits

Reviewing files that changed from the base of the PR and between 3502b37 and de101bd.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • packages/react-core/package.json
  • packages/react-core/src/components/Hero/Hero.tsx
  • packages/react-core/src/components/Hero/__tests__/Hero.test.tsx
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-tokens/package.json

Comment thread packages/react-core/src/components/Hero/__tests__/Hero.test.tsx
Copy link
Copy Markdown
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Just a question below, but lgtm

Comment on lines +37 to +38
/** Flag indicating the hero has glass styling when glass theme is applied. */
isGlass?: boolean;
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.

Do we want this to be beta?

Copy link
Copy Markdown
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

D-d-double approval, now with 125% more correct rhds-icon version

@kmcfaul kmcfaul closed this May 8, 2026
@kmcfaul kmcfaul reopened this May 8, 2026
@kmcfaul
Copy link
Copy Markdown
Contributor Author

kmcfaul commented May 8, 2026

closed/reopened to rerun snyk

Comment thread packages/react-core/src/components/Hero/Hero.tsx
@wise-king-sullyman wise-king-sullyman requested a review from mcoker May 8, 2026 16:25
Copy link
Copy Markdown
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

🦸‍♂️

@mcoker mcoker merged commit bea138e into patternfly:main May 8, 2026
24 checks passed
@patternfly-build
Copy link
Copy Markdown
Collaborator

Your changes have been released in:

  • @patternfly/react-charts@8.5.0-prerelease.27
  • @patternfly/react-code-editor@6.5.0-prerelease.76
  • @patternfly/react-core@6.5.0-prerelease.73
  • @patternfly/react-docs@7.5.0-prerelease.84
  • @patternfly/react-drag-drop@6.5.0-prerelease.74
  • @patternfly/react-icons@6.5.0-prerelease.34
  • demo-app-ts@6.5.0-prerelease.102
  • @patternfly/react-styles@6.5.0-prerelease.24
  • @patternfly/react-table@6.5.0-prerelease.76
  • @patternfly/react-templates@6.5.0-prerelease.73
  • @patternfly/react-tokens@6.5.0-prerelease.23

Thanks for your contribution! 🎉

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.

Hero - glass style updates

5 participants