Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions shesha-reactjs/src/components/reactTable/styles/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
const shaReactTable = cx(
'sha-react-table',
css`
${backgroundColor ? `background: ${backgroundColor};` : 'background: white;'}
/* These styles are suggested for the table fill all available space in its containing element */
display: block;
display: inline-block;
width: max-content;
min-width: calc(100% - 16px);
Comment on lines +193 to +195
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Tie the -16px min-width to the boxShadow margin.
The width reduction is applied even when no boxShadow/margin is set, which can leave an unintended gap or trigger horizontal scroll in full-width layouts. Consider applying the subtraction only when the 8px margins are actually added.

♻️ Suggested adjustment
-      min-width: calc(100% - 16px);
+      min-width: ${boxShadow ? 'calc(100% - 16px)' : '100%'};
🤖 Prompt for AI Agents
In `@shesha-reactjs/src/components/reactTable/styles/styles.ts` around lines 193 -
195, The current rule sets min-width: calc(100% - 16px) unconditionally, causing
unwanted gaps when no box-shadow/margins are present; change the styling to only
subtract the 16px when the box-shadow margin is applied by either (A)
introducing a CSS variable (e.g., --box-shadow-margin) and using min-width:
calc(100% - var(--box-shadow-margin, 0)) so the subtraction defaults to 0, or
(B) move min-width: calc(100% - 16px) into a conditional class (e.g.,
.withBoxShadow or .hasBoxShadow) that you add when the 8px margins are present;
update the rule that defines display, width and min-width in styles.ts to use
one of these approaches so the subtraction is only applied when the boxShadow
margin exists.

/* These styles are required for a horizontaly scrollable table overflow */
/* IMPORTANT: freezeHeaders requires overflow: auto for position: sticky to work */
overflow: ${freezeHeaders ? 'auto' : (boxShadow ? 'visible' : 'auto')};
Expand Down Expand Up @@ -226,7 +226,8 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
border-spacing: 0;
display: inline-block;
min-width: 100%;
background: transparent;
/* Background applied to table ensures it covers all rows when scrolling with freezeHeaders */
${backgroundColor ? `background: ${backgroundColor};` : 'background: white;'}

/* Apply border styles to the inner table */
${Object.entries(borderStyles).map(([key, value]) => {
Expand Down
Loading