-
Notifications
You must be signed in to change notification settings - Fork 61
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(ui): info card grid #17391
fix(ui): info card grid #17391
Conversation
WalkthroughThe pull request introduces significant modifications to the Changes
Sequence DiagramsequenceDiagram
participant User
participant InfoCardGrid
participant InfoCard
participant DetailedInfoCard/SimpleInfoCard
User->>InfoCardGrid: Render with props
InfoCardGrid->>InfoCardGrid: Determine card size
InfoCardGrid->>InfoCard: Create cards with background/border
InfoCard->>DetailedInfoCard/SimpleInfoCard: Render with specific variant
DetailedInfoCard/SimpleInfoCard-->>InfoCardGrid: Display card content
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Datadog ReportAll test runs ✅ 10 Total Test Services: 0 Failed, 10 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (1)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.tsx (1)
62-70
: Dynamic CSS class assignments for grid layouts.
You may want to consider building a map-based approach (e.g.,const containerClassBySize = {...}
), but the existing conditional works.libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.tsx (1)
33-34
: Defaulting background and borderColor to white.
Consider whether you want a no-border scenario or a different fallback for borderColor.libs/island-ui/core/src/lib/InfoCardGrid/DetailedInfoCard.tsx (1)
100-105
: Use semantic cues to avoid confusion for disabled tags.
If the tag is non-interactive and purely informational, disabling it might imply that it should not be clickable. Consider removingdisabled
if you don’t intend any interactive behavior, or if you want to visually differentiate it, use styling props or a variant.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
libs/island-ui/core/src/lib/InfoCardGrid/DetailedInfoCard.tsx
(4 hunks)libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.css.ts
(1 hunks)libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.tsx
(2 hunks)libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.stories.tsx
(1 hunks)libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.tsx
(1 hunks)libs/island-ui/core/src/lib/InfoCardGrid/SimpleInfoCard.tsx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
libs/island-ui/core/src/lib/InfoCardGrid/SimpleInfoCard.tsx (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.tsx (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/island-ui/core/src/lib/InfoCardGrid/DetailedInfoCard.tsx (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.stories.tsx (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.css.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.tsx (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
🔇 Additional comments (37)
libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.tsx (13)
4-4
: Good import ofBox
andBoxProps
.
This centralizes styling in a single component, promoting consistent usage of the design system.
7-7
: Importing the CSS module is appropriate.
This approach keeps the styles well-organized in one location.
10-13
: Excludingbackground
fromInfoCardItemProps
looks correct.
You're ensuring thatbackground
is handled at the grid level rather than at the individual card level, which can ease overall styling consistency.
19-20
: Optional background and border props are a nice addition.
Allowing customization ofcardsBackground
andcardsBorder
improves the component’s reusability and configurability.
23-23
: Explicit card sizing enum is clean.
Defining'small' | 'medium' | 'large'
clarifies the supported size options.
25-40
: Check for edge cases inmapColumnCountToCardSize
.
Ifcolumns
is something other than 1–3, the function defaults to'small'
. That might be unexpected in certain layouts. Consider validating or logging a warning ifcolumns
is out of range.
42-48
: Destructuring added props nicely.
This enhancement keeps your code clear and ensures new props (cardsBackground
,cardsBorder
) remain optional.
53-53
: Breakpoint adjustment requires verification.
Switching frommd
tosm
changes the threshold for mobile layout. Confirm that this aligns with the new design requirements.
59-59
: Leverages the new size-mapping function correctly.
mapColumnCountToCardSize
usage is straightforward and keeps consistent sizing logic in one place.
74-74
: PropagatingcardsBackground
.
This is a clean way to apply a unified background to all cards.
75-75
: PropagatingcardsBorder
.
Good approach—gives consistent theming control across all items in the grid.
77-77
: Potentially conflicting withmapColumnCountToCardSize
.
Here,isMobile
forces'medium'
, whilemapColumnCountToCardSize
returns'large'
ifisMobile
is true. Reassess the desired mobile size to avoid confusion.
81-81
: End of the grid container.
No further action needed.libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.css.ts (4)
4-8
: Base grid container styling.
Centralizing grid definitions here fosters maintainability and consistent spacing across columns.
10-12
: One-column grid layout.
Straightforward usage, aligning with the newInfoCardGrid
logic.
15-17
: Two-column grid layout.
Looks good—ensures consistent column structure for moderate layouts.
20-22
: Three-column grid layout.
Implementation is consistent with the one- and two-column styles.libs/island-ui/core/src/lib/InfoCardGrid/InfoCard.tsx (6)
3-3
: ImportingBoxProps
andFocusableBox
.
This aligns the component with the new design system approach.
10-10
: Optionalbackground
prop.
Expanding the base props for dynamic styling is beneficial for adaptability.
12-12
: OptionalborderColor
prop.
Matches the newInfoCardGrid
usage for consistent border theming.
40-40
: Wrapping content in a paddedBox
.
Maintains layout consistency; no immediate concerns.
42-42
: UsingDetailedInfoCard
with a passedsize
.
This is in line with the simplified component architecture.
44-44
: UsingSimpleInfoCard
with a passedsize
.
Good consistency with the detailed variant.libs/island-ui/core/src/lib/InfoCardGrid/SimpleInfoCard.tsx (1)
35-46
: Refactored content rendering for large size.
By removing theGridContainer
, you simplify the layout. Verify that losing the container does not break any padding or alignment that was previously handled.libs/island-ui/core/src/lib/InfoCardGrid/InfoCardGrid.stories.tsx (10)
1-3
: Essential imports for the Storybook file.
No issues—this is a standard approach.
4-8
: Utility imports help with expanded coverage.
withFigma
integration can make UX reviews more streamlined.
9-33
: Metadata definition for the Storybook component.
Provides a clear structure for controlling args.
35-35
: Default export meta.
Adheres to Storybook guidelines for naming and structuring stories.
37-38
: Declared type alias for the story.
This is a neat approach for strongly typed story definitions.
39-48
:generateSimpleCard
function.
Keeps sample data DRY for story generation.
50-90
:generateDetailedCard
function.
Comprehensive placeholder data ensures robust visual testing in Storybook.
92-97
:generateCards
utility.
Console loggingvariant
is okay, though consider removing it if it's purely for debugging.
99-108
: Detailed example story.
Demonstrates a one-column layout with the new background and border props.
109-116
: Simple example story with three columns.
Offers good coverage of multi-column usage in Storybook.libs/island-ui/core/src/lib/InfoCardGrid/DetailedInfoCard.tsx (3)
78-78
: Ensure visual consistency of text size.
Switching the variant tosmall
might be intentional to highlight detail lines in a smaller font. Double-check that this aligns with the rest of the design to maintain balance and readability.
[approve]
145-159
: Validate responsiveness with the new grid layout.
You’re using an 8/12 and 4/12 split for large sizes. Confirm that this still displays correctly on smaller breakpoints. Also, verify that the new column structure is compatible with the updatedInfoCardGrid
CSS changes for consistent spacing.
169-171
: Keep text weight and size consistent.
Themedium
variant with alight
weight here may differ from other paragraphs in the component. Confirm that this is intentional for a more delicate look.
What
Why
Screenshots / Gifs
Checklist:
Summary by CodeRabbit
New Features
InfoCardGrid
component with more flexible layout optionsRefactor
InfoCard
andSimpleInfoCard
Documentation
InfoCardGrid
configurations