Skip to content

CC-41: <Select/> is Missing size Prop#22

Closed
ianpaschal wants to merge 2 commits into
masterfrom
ian/cc-41-select-is-missing-size-prop
Closed

CC-41: <Select/> is Missing size Prop#22
ianpaschal wants to merge 2 commits into
masterfrom
ian/cc-41-select-is-missing-size-prop

Conversation

@ianpaschal
Copy link
Copy Markdown
Owner

@ianpaschal ianpaschal commented May 13, 2026

Fixes CC-41

Summary by CodeRabbit

  • New Features

    • Added MasonryGrid component for responsive grid layouts with configurable columns, gap settings, and responsive width constraints.
    • Select component now includes size variants (small, normal, large).
  • Bug Fixes

    • Improved null value handling in Select component.
  • Style

    • Refined Select component styling for better visual consistency.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Walkthrough

This PR introduces a new MasonryGrid component for responsive masonry layouts, adds a size prop to the existing Select component, and adjusts a padding utility mixin. The MasonryGrid component uses a ResizeObserver hook to dynamically compute column counts based on container width and CSS variables, distributes child elements across columns, and applies CSS Grid styling. The Select component gains a configurable size option (small, normal, large) that replaces hardcoded height and padding constraints. A padding utility mixin is updated to support asymmetric horizontal padding.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title "CC-41: is Missing size Prop" addresses only the Select component size prop fix, but the changeset includes a substantial new MasonryGrid component (5 new files) alongside the Select updates, making the title incomplete and misleading about the scope of changes. Update the title to reflect both major changes, such as: "Add MasonryGrid component and implement size prop for Select" or scope the PR to focus on one change per pull request.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ian/cc-41-select-is-missing-size-prop

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Stylelint (17.11.0)
src/components/MasonryGrid/MasonryGrid.module.scss

ConfigurationError: Could not find "stylelint-config-clean-order". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:285:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:252:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:85:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:138:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:127:22)

src/style/sizes.module.scss

ConfigurationError: Could not find "stylelint-config-clean-order". Do you need to install the package or use the "configBasedir" option?
at getModulePath (file:///usr/local/lib/node_modules/stylelint/lib/utils/getModulePath.mjs:29:9)
at loadExtendedConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:285:21)
at extendConfig (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:252:25)
at async augmentConfigBasic (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:85:20)
at async augmentConfigFull (file:///usr/local/lib/node_modules/stylelint/lib/augmentConfig.mjs:138:24)
at async getConfigForFile (file:///usr/local/lib/node_modules/stylelint/lib/getConfigForFile.mjs:102:26)
at async resolveOptionValue (file:///usr/local/lib/node_modules/stylelint/lib/utils/resolveOptionValue.mjs:27:24)
at async standalone (file:///usr/local/lib/node_modules/stylelint/lib/standalone.mjs:127:22)


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.

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: 4

🤖 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 `@src/components/MasonryGrid/MasonryGrid.hooks.ts`:
- Line 41: The initial state for columnCount is set with minColumns which can be
out of range before the effect runs; change the useState initializer to use the
already-computed clampedMinColumns (i.e., useState(clampedMinColumns)) so
columnCount starts within [minColumns, maxColumns] consistently — update the
initializer where columnCount and setColumnCount are declared and ensure
clampedMinColumns is computed before that call.

In `@src/components/MasonryGrid/MasonryGrid.module.scss`:
- Around line 1-4: The .masonry-grid rule currently uses gap:
var(--masonry-column-gap) which affects both row and column spacing; update this
to use column-gap: var(--masonry-column-gap) in the .masonry-grid selector
(keeping the existing variable name --masonry-column-gap) so the intent of only
controlling horizontal spacing is explicit and row gaps remain unaffected.

In `@src/components/MasonryGrid/MasonryGrid.tsx`:
- Around line 40-44: The current comment above the distribution logic is
misleading: the code using Children.forEach and columns[index % columnCount]
implements a round-robin distribution across columns (left-to-right, wrapping
top-to-bottom), not "top-to-bottom, left-to-right"; update the comment to
something like "Distribute children round-robin across columns (left-to-right,
wrapping top-to-bottom)" and keep the existing logic using columns, columnCount,
and Children.forEach unchanged.
- Around line 40-55: The child wrapper uses rowIndex as the key which shifts
when items move; update the distribution in the Children.forEach loop (the code
that builds columns) to store each child's original index (e.g., push a tuple or
object containing { node: child, originalIndex: index } into columns) and then
update the rendering in columns.map / column.map to use that stored
originalIndex as the key for the outer wrapper instead of rowIndex so keys
remain stable across insertions/removals.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 5834f92e-df26-41c8-b17a-a36c344d041c

📥 Commits

Reviewing files that changed from the base of the PR and between 20fa651 and 7bd804e.

📒 Files selected for processing (11)
  • src/components/MasonryGrid/MasonryGrid.hooks.ts
  • src/components/MasonryGrid/MasonryGrid.module.scss
  • src/components/MasonryGrid/MasonryGrid.module.scss.d.ts
  • src/components/MasonryGrid/MasonryGrid.stories.tsx
  • src/components/MasonryGrid/MasonryGrid.tsx
  • src/components/MasonryGrid/index.ts
  • src/components/Select/Select.module.scss
  • src/components/Select/Select.stories.tsx
  • src/components/Select/Select.tsx
  • src/index.ts
  • src/style/sizes.module.scss
💤 Files with no reviewable changes (1)
  • src/components/Select/Select.module.scss

const clampedMaxColumns = Math.max(minColumns, maxColumns);

const ref = useRef<HTMLDivElement>(null);
const [columnCount, setColumnCount] = useState(minColumns);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Initialize state with clamped value for consistency.

The initial state uses minColumns directly, but if minColumns > maxColumns, the state will briefly hold an invalid value until the effect runs and corrects it. Initialize with clampedMinColumns to maintain consistency from the first render.

✨ Proposed fix
-  const [columnCount, setColumnCount] = useState(minColumns);
+  const [columnCount, setColumnCount] = useState(clampedMinColumns);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const [columnCount, setColumnCount] = useState(minColumns);
const [columnCount, setColumnCount] = useState(clampedMinColumns);
🤖 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 `@src/components/MasonryGrid/MasonryGrid.hooks.ts` at line 41, The initial
state for columnCount is set with minColumns which can be out of range before
the effect runs; change the useState initializer to use the already-computed
clampedMinColumns (i.e., useState(clampedMinColumns)) so columnCount starts
within [minColumns, maxColumns] consistently — update the initializer where
columnCount and setColumnCount are declared and ensure clampedMinColumns is
computed before that call.

Comment thread src/components/MasonryGrid/MasonryGrid.module.scss
Comment thread src/components/MasonryGrid/MasonryGrid.tsx
Comment thread src/components/MasonryGrid/MasonryGrid.tsx
@ianpaschal ianpaschal closed this May 13, 2026
@ianpaschal ianpaschal deleted the ian/cc-41-select-is-missing-size-prop branch May 13, 2026 12:36
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.

1 participant