Skip to content

Commit 6caf253

Browse files
committed
Always align visual icons and action items at the first line of an item
1 parent 6e24a94 commit 6caf253

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

.changeset/funny-pears-invent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openproject/primer-view-components': patch
3+
---
4+
5+
Fix alignment of Visuals and Action items within the TreeView

app/components/primer/alpha/tree_view.pcss

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,25 +284,29 @@
284284

285285
/* The visual icons should appear vertically centered for single-line items, but remain at the top for items that wrap
286286
across more lines. */
287+
align-self: baseline;
287288
height: var(--custom-line-height, 1.3rem);
288289
color: var(--fgColor-muted);
289290
align-items: center;
290291
}
291292

292293
& .TreeViewItemLeadingAction {
293-
display: flex;
294-
color: var(--fgColor-muted);
295294
grid-area: leadingAction;
296-
297-
& > button {
298-
flex-shrink: 1;
299-
}
300295
}
301296

302297
& .TreeViewItemTrailingAction {
298+
grid-area: trailingAction;
299+
}
300+
301+
& .TreeViewItemTrailingAction,
302+
& .TreeViewItemLeadingAction {
303303
display: flex;
304304
color: var(--fgColor-muted);
305-
grid-area: trailingAction;
305+
/* The dynamic top and bottom padding to maintain the minimum item height for single line items while cancelling out the invisible area of the button */
306+
/* stylelint-disable-next-line primer/spacing */
307+
padding-top: calc((var(--min-item-height) - var(--custom-line-height, 1.3rem) - 12px) / 2);
308+
/* stylelint-disable-next-line primer/spacing */
309+
padding-bottom: calc((var(--min-item-height) - var(--custom-line-height, 1.3rem) - 12px) / 2);
306310

307311
& > button {
308312
flex-shrink: 1;

0 commit comments

Comments
 (0)