Skip to content

feat(ui): Update Table with Fixed Height#364

Merged
kylengn merged 1 commit intofeat/update-modal-body-headerfrom
feat/update-fixed-height-table
Jan 29, 2026
Merged

feat(ui): Update Table with Fixed Height#364
kylengn merged 1 commit intofeat/update-modal-body-headerfrom
feat/update-fixed-height-table

Conversation

@kylengn
Copy link
Contributor

@kylengn kylengn commented Jan 29, 2026

Summary by CodeRabbit

  • New Features
    • ModalBodyHeader component now accepts additional custom content.
    • Data table enhanced with dynamic height calculations for consistent layout, improved empty-state handling with placeholder rows, and optimized pagination visibility.
    • Table component now supports inline style customization for greater styling flexibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@kylengn kylengn self-assigned this Jan 29, 2026
@kylengn kylengn requested a review from noe-charmet as a code owner January 29, 2026 07:44
Copilot AI review requested due to automatic review settings January 29, 2026 07:44
@vercel
Copy link

vercel bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
react-ui Ready Ready Preview, Comment Jan 29, 2026 7:44am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

This pull request extends the ModalBodyHeader component with support for additional children content, implements dynamic table height calculations for consistent layout management, adds inline style support to the table wrapper, and adjusts test data sample size.

Changes

Cohort / File(s) Summary
Modal Component Enhancement
.changeset/wild-rabbits-kick.md, libs/react/ui/src/components/modal/modal.tsx
Introduces minor version bump and adds children prop to ModalBodyHeader component for rendering additional content after the description block.
Table Height & Layout Calculations
libs/react/ui/src/components/table/data-table.tsx
Implements dynamic table height calculations using computed values (rowCount, hasRows, currentPageSize, minTableHeight, shouldShowPagination, emptyRowCount). Reworks rendering flow to conditionally display rows, headers, pagination, and empty-state placeholders while maintaining consistent layout.
Table Wrapper Enhancement
libs/react/ui/src/components/table/table.tsx
Adds support for inline styles via style prop on the outer container div without altering the table's public API.
Test Data Configuration
libs/react/ui/src/components/table/table.stories.data.ts
Reduces sample jobsData size from 100 to 51 entries for testing purposes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • EnzalRad
  • dvxam
  • noe-charmet

Poem

Hoppy tables bound and spring, 🐰
Heights that dance and layouts sing,
ModalChildren now embrace,
Styles flow with perfect grace! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: introducing dynamic height calculations and styling to the data table component to support fixed height functionality.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@argos-ci
Copy link

argos-ci bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 15 changed Jan 29, 2026, 7:46 AM

Copy link

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
libs/react/ui/src/components/table/table.tsx (1)

6-14: Style is applied to both wrapper and table element.

The style prop is applied to the wrapper div (line 8) but is also passed through to the <table> via {...props} (line 13). This means minHeight (and any other inline styles) will be applied to both elements, which is likely unintended.

Consider destructuring style out of props:

🐛 Proposed fix
-function Table({className, ...props}: ComponentProps<'table'>) {
+function Table({className, style, ...props}: ComponentProps<'table'>) {
   return (
     <div
       className="relative w-full overflow-auto scrollbar rounded-x-8 rounded-b-8"
-      style={props.style}
+      style={style}
     >
       <table
         data-slot="table"
         className={cn('w-full caption-bottom text-sm', className)}
         {...props}
       />
     </div>
   );
 }
libs/react/ui/src/components/table/data-table.tsx (1)

233-251: Skeleton column count mismatch when selection is enabled.

The loading skeleton uses columns.map() (line 235, 245), but when showSelectedCount is true, the actual table uses columnsWithSelection which includes an additional selection column. This will cause the skeleton to render one fewer column than the loaded table.

🐛 Proposed fix
           <TableHeader>
             <TableRow className="hover:bg-transparent border-b">
-              {columns.map((_, idx) => (
+              {columnsWithSelection.map((_, idx) => (
                 <TableHead key={idx.toString()}>
                   <Skeleton className="h-16 w-24" />
                 </TableHead>
               ))}
             </TableRow>
           </TableHeader>
           <TableBody>
             {Array.from({length: skeletonRowCount}).map((_, rowIdx) => (
               <TableRow key={rowIdx.toString()} className="hover:bg-transparent">
-                {columns.map((_, colIdx) => (
+                {columnsWithSelection.map((_, colIdx) => (
                   <TableCell key={colIdx.toString()}>
                     <Skeleton className="h-16 w-full" />
                   </TableCell>
                 ))}
               </TableRow>
             ))}
           </TableBody>
🧹 Nitpick comments (2)
.changeset/wild-rabbits-kick.md (1)

1-5: Changeset description is incomplete.

The changeset only mentions the ModalBodyHeader update, but this PR also includes significant changes to the DataTable component (dynamic height calculations, pagination logic, empty row handling) and the Table component (inline style support). Consider updating the description to reflect all user-facing changes.

libs/react/ui/src/components/table/data-table.tsx (1)

216-224: Consider extracting height constants.

The magic numbers for heights (40, 40, 48) could be extracted to named constants at the module level for better maintainability and self-documentation.

♻️ Suggested refactor
+const TABLE_HEADER_HEIGHT = 40;
+const TABLE_ROW_HEIGHT = 40;
+const TABLE_PAGINATION_HEIGHT = 48;
+
 export function DataTable<TData, TValue>({
   // ...
 }) {
   // ...
-  const headerHeight = 40;
-  const rowHeight = 40;
-  const paginationHeight = 48;
+  const headerHeight = TABLE_HEADER_HEIGHT;
+  const rowHeight = TABLE_ROW_HEIGHT;
+  const paginationHeight = TABLE_PAGINATION_HEIGHT;

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements a fixed-height table feature for paginated tables and adds a children prop to the ModalBodyHeader component. The main changes focus on maintaining consistent table height across pagination by adding empty placeholder rows when the current page has fewer rows than the page size.

Changes:

  • Implemented fixed-height table with minimum height calculation based on header, rows, and pagination footer heights
  • Added empty placeholder rows to fill remaining space when current page has fewer rows than page size
  • Forwarded style prop to table wrapper div to support custom height styling
  • Added children prop to ModalBodyHeader component for additional content flexibility
  • Reduced test data count from 100 to 51 rows for better demonstration of pagination

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
libs/react/ui/src/components/table/table.tsx Added style prop forwarding to wrapper div for custom height support
libs/react/ui/src/components/table/data-table.tsx Implemented fixed-height table logic with empty row padding and height calculations
libs/react/ui/src/components/modal/modal.tsx Added children prop to ModalBodyHeader component
libs/react/ui/src/components/table/table.stories.data.ts Reduced sample data count from 100 to 51 for pagination testing
.changeset/wild-rabbits-kick.md Added changeset for version tracking
Comments suppressed due to low confidence (1)

libs/react/ui/src/components/table/table.tsx:13

  • The style prop is being applied to the wrapping div, but props (which includes style) is also spread onto the table element. This means if a style prop is passed, it will be applied to both the div wrapper and the table element itself, which may not be the intended behavior. Consider either extracting the style prop from props before spreading, or documenting that style is meant to apply to the wrapper div only.
    <div
      className="relative w-full overflow-auto scrollbar rounded-x-8 rounded-b-8"
      style={props.style}
    >
      <table
        data-slot="table"
        className={cn('w-full caption-bottom text-sm', className)}
        {...props}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1 to 5
---
"@shipfox/react-ui": minor
---

Update ModalBodyHeader component
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The changeset only mentions "Update ModalBodyHeader component" but the PR title is "Feat/update fixed height table" and includes significant changes to the table components (fixed height implementation, empty row padding, etc.). The changeset should describe all the changes in this PR, not just the modal update.

Copilot uses AI. Check for mistakes.
Comment on lines +216 to +218
const headerHeight = 40;
const rowHeight = 40;
const paginationHeight = 48;
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The hardcoded height values (headerHeight = 40, rowHeight = 40, paginationHeight = 48) are magic numbers that could become out of sync with the actual CSS styling. Consider extracting these as named constants at the module level with comments explaining how they align with the CSS classes (e.g., h-40 for header, py-10 + leading-20 for rows), or consider using CSS variables or a more maintainable approach to ensure these values stay synchronized with the actual rendered heights.

Copilot uses AI. Check for mistakes.
<TableCell
colSpan={table.getAllColumns().length}
className="h-240 text-center rounded-t-8"
className="h-240 text-center rounded-t-8 hover:bg-transparent"
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The className includes both "hover:bg-transparent" in the TableRow and then again in the nested TableCell className. While this doesn't break anything, the hover:bg-transparent on the TableCell is redundant since it's already applied to the parent TableRow. Consider removing the duplicate from the TableCell className.

Suggested change
className="h-240 text-center rounded-t-8 hover:bg-transparent"
className="h-240 text-center rounded-t-8"

Copilot uses AI. Check for mistakes.
Comment on lines +312 to +316
{table.getAllColumns().map((column) => (
<TableCell key={column.id}>
<span className="invisible">.</span>
</TableCell>
))}
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The empty rows use table.getAllColumns() to generate cells, while actual data rows use row.getVisibleCells(). If column visibility is toggled, this could result in a mismatch where empty rows have more cells than data rows. Consider using table.getVisibleLeafColumns() or a similar approach to ensure empty rows match the visible column count of data rows.

Copilot uses AI. Check for mistakes.
@kylengn kylengn changed the base branch from main to feat/update-modal-body-header January 29, 2026 07:49
@kylengn kylengn changed the title Feat/update fixed height table feat(ui): Update Table with Fixed Height Jan 29, 2026
@kylengn kylengn merged commit 0195482 into feat/update-modal-body-header Jan 29, 2026
11 checks passed
@kylengn kylengn deleted the feat/update-fixed-height-table branch January 29, 2026 07:50
kylengn added a commit that referenced this pull request Jan 30, 2026
* feat(modal): add children prop to ModalBodyHeader for flexible content rendering

* feat(ui): update ModalBodyHeader component

* feat(ui): remove hover state of empty table

* feat(ui): enhance DataTable component with dynamic row height and pagination handling (#364)

* feat(ui): update ModalBodyHeader and Table components for improved functionality

* feat(ui): adjust row and pagination heights in DataTable and update TableCell styles for better layout
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