Repository navigation
fix(textbadge)!: remove outer horizontal margin — BREAKING: badges now need a gapped parent (CUI-51) - #1254
fix(textbadge)!: remove outer horizontal margin — BREAKING: badges now need a gapped parent (CUI-51)#1254eve-ci-cd[bot] wants to merge 6 commits into
Conversation
Part of the implementation plan from scality/agent-task#614. Issue: CUI-51
…I-51) Part of the implementation plan from scality/agent-task#614. Issue: CUI-51
…d narrow-column story (CUI-51) Part of the implementation plan from scality/agent-task#614. Issue: CUI-51
|
/approve |
Hello eve-ci-cd[bot],My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following options are set: approve |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following options are set: approve |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following options are set: approve |
… margin (CUI-51) Removing TextBadge's outer margin reintroduced one on a TabBadge wrapper. Use a flex gap on TabItem instead, and trim ButtonIcon's own r8 padding to r4 so it does not stack with that gap. Measured in Storybook on Components/Navigation/Tabs: icon-to-label stays at r8 and label-to-badge at r4, matching the pre-PR build pixel for pixel. Issue: CUI-51
| border-radius: 4px; | ||
| font-size: 0.9rem; | ||
| font-weight: ${fontWeight.bold}; | ||
| margin: 0 ${spacing.r4} 0 ${spacing.r4}; |
There was a problem hiding this comment.
Removing this margin changes the stable TextBadge exported from index.ts. Every external consumer with adjacent badges, or a label next to a badge, loses 4px of spacing without any warning. CLAUDE.md says to ship this kind of change behind a major release or as a new version in next.ts. Either do that, or make sure the release gets a breaking-change bump and a migration note ("wrap badges in a gapped parent").
🔴 Request changesWhy the tests need changes
This review is advisory and does not block the merge. Full reviewThe test exercises code without verifying any outcome
|
…-51) The gap compensation was unconditional, so an icon-only tab gained r4 of trailing space that ButtonIcon never adds. Mirror ButtonIcon's own condition. Verified in Storybook: with a label the icon keeps padding-right r4 and sits r8 from the label; with an empty label the padding resolves to 0. Issue: CUI-51
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following options are set: approve |
… the bug (CUI-51) The story put the long badge inside a vertical Stack, and StackBox is display: flex, so the badge was blockified into a single box. Wrapped lines lined up with or without the old margin, which is the regression the story exists to cover. Rendering it directly in the 160px block keeps it display: inline. Measured in Storybook: the badge now spans 2 line fragments, both starting at the container's content edge; re-adding margin: 0 r4 splits them to 3 fragments starting at 87.5 / 84 / 84, reproducing CUI-51. Issue: CUI-51
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following options are set: approve |
TL;DR —
TextBadgeno longer carries an outer horizontal margin, so a badge lines up with its container's edge and every wrapped line of a long label starts at the same x. Tabs keep their original spacing through agaponTabIteminstead of a per-child margin.📷 Screenshots
Context / Why
On an inline span, a horizontal margin only applies to the first and last line fragments. A badge placed first in a column sat 4px off the edge, and wrapped lines started at different x positions (CUI-51).
🧩 Approach
TextBadge.component.tsx— dropmargin: 0 ${spacing.r4} 0 ${spacing.r4}fromStyledTextBadge.StyledTabs.ts/Tabsv2.component.tsx—TabItemgetsgap: r4, andTabIcontrimsButtonIcon's ownpadding-rightfrom r8 to r4 so it does not stack with that gap. An icon with no label gets no padding, matchingButtonIcon.stories/textbadge.stories.tsx— adjacent badges take their spacing from a parentStack gap="r8". The narrow-container story renders the long badge directly in the 160px block, so it staysdisplay: inlineand actually splits into line fragments.Measured
Root font-size is 14px here, so
r4= 3.5px andr8= 7px.Components/Navigation/Tabs › WithQueryParams, against the pre-PR build:Adding the gap without trimming
TabIconwould have pushed icon → label to 10.5px.Components/TextBadge › Long Label In Narrow Container: the badge spans 2 line fragments, both starting at the container's content edge (84 / 84). Re-addingmargin: 0 r4turns it into 3 fragments starting at 87.5 / 84 / 84 — the CUI-51 symptom. The previousStackversion rendered the badge as a single block box and could not show this at all.🔍 Review focus
🔴
TextBadge.component.tsx › StyledTextBadge— this is the breaking change CUI-51 asks for, not an incidental one. The ticket states it:Adjacent badges, or a label next to a badge, lose 4px until the parent supplies a gap. Consumers are not updated here — the consumer pass is tracked by AIX-1236. Migration for downstream: wrap badges in a gapped parent (
<Stack gap="r4">).Tabsv2.component.tsx › TabIcon— the r8 → r4 trim is what keeps icon-to-label unchanged; it depends onTabItem's gap supplying the other r4.🔗 References
Issue: CUI-51