Skip to content
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: prevent extra padding in centered header cells when no buttons are displayed #502

Merged
merged 2 commits into from
Mar 14, 2025

Conversation

alessandrojcm
Copy link
Collaborator

@alessandrojcm alessandrojcm commented Mar 14, 2025

Description

This PR fixes issue #414 where header cells with align: 'center' were not properly centered due to extra padding being added even when no buttons were displayed.

Problem

The issue was in the MRT_TableHeadCell component, where padding was being added based on the showColumnButtons condition, even when there were no actual buttons or actions to display. This caused centered header cells to appear off-center compared to body cells with the same alignment.

Solution

Modified the headerPL calculation to only add padding when there are actual buttons or actions to display:

// Before
if (showColumnButtons) pl += 1.75;

// After
if (showColumnButtons && (columnActionsEnabled || showDragHandle)) pl += 1.75;

closes #414

@alessandrojcm alessandrojcm linked an issue Mar 14, 2025 that may be closed by this pull request
1 task
Copy link

vercel bot commented Mar 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mantine-react-table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 5:39pm
mantine-react-table-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 5:39pm

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.

Broken centered header
2 participants