Skip to content

Commit 10ced0d

Browse files
authored
fix: cell width child (#5870)
1 parent c62d524 commit 10ced0d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.changeset/wise-planes-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ultraviolet/ui": patch
3+
---
4+
5+
`List.Cell`: fix width of child to take into account padding

packages/ui/src/components/List/styles.css.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const colorChange = keyframes({
2727
},
2828
})
2929

30+
const listCellPadding = theme.space[2]
31+
3032
function makeRowStyleSentiment(sentiment: (typeof SENTIMENTS)[number]) {
3133
const color = theme.colors[sentiment]
3234
const base = {
@@ -206,7 +208,7 @@ export const listCell = style({
206208
display: 'table-cell',
207209
verticalAlign: 'middle',
208210
height: theme.sizing[750],
209-
padding: `0 ${theme.space[2]}`,
211+
padding: `0 ${listCellPadding}`,
210212
transition: 'box-shadow 200ms ease, border-color 200ms ease',
211213
borderTop: `1px solid ${theme.colors.neutral.border}`,
212214
borderBottom: `1px solid ${theme.colors.neutral.border}`,
@@ -231,9 +233,10 @@ export const listCell = style({
231233
})
232234

233235
globalStyle(`${listCell} > *`, {
234-
width: widthCell,
235-
maxWidth: maxWidthCell,
236-
minWidth: minWidthCell,
236+
/** Remove padding from width to avoid overflow since boxSizing = 'content-box' */
237+
width: `calc(${widthCell} - ${listCellPadding} - ${listCellPadding})`,
238+
maxWidth: `calc(${maxWidthCell} - ${listCellPadding} - ${listCellPadding})`,
239+
minWidth: `calc(${minWidthCell} - ${listCellPadding} - ${listCellPadding})`,
237240
})
238241

239242
globalStyle(`${listRowBase} > td:first-child`, {

0 commit comments

Comments
 (0)