feat(Hero): glass styling update#12412
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughThis PR replaces Hero's ChangesHero Component Glass Prop Migration
🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Preview: https://pf-react-pr-12412.surge.sh A11y report: https://pf-react-pr-12412-a11y.surge.sh |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/react-core/src/components/Hero/Hero.tsx (1)
37-38: ⚡ Quick winConsider a temporary compatibility bridge for the removed
hasNoGlassprop.Dropping
hasNoGlassoutright introduces a breaking API change for existing consumers. A short deprecation window (accept both props, preferisGlass) 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
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (8)
packages/react-core/package.jsonpackages/react-core/src/components/Hero/Hero.tsxpackages/react-core/src/components/Hero/__tests__/Hero.test.tsxpackages/react-core/src/demos/Compass/examples/CompassDemo.tsxpackages/react-docs/package.jsonpackages/react-icons/package.jsonpackages/react-styles/package.jsonpackages/react-tokens/package.json
thatblindgeye
left a comment
There was a problem hiding this comment.
Just a question below, but lgtm
| /** Flag indicating the hero has glass styling when glass theme is applied. */ | ||
| isGlass?: boolean; |
There was a problem hiding this comment.
Do we want this to be beta?
thatblindgeye
left a comment
There was a problem hiding this comment.
D-d-double approval, now with 125% more correct rhds-icon version
What: Closes #12413
Additional issues:
Summary by CodeRabbit
New Features
Tests
Chores
Docs / Demos