Skip to content

Commit 306b7f6

Browse files
authored
fix(ui): misalignment of nested toggles on document API tab (#13424)
Fixes the weird misalignment of toggles in the API tab Before: <img width="799" height="1011" alt="image" src="https://github.com/user-attachments/assets/5fc9768c-24de-4d89-a1ba-6dd606f76bec" /> After: <img width="815" height="1069" alt="image" src="https://github.com/user-attachments/assets/253dfdaa-7fca-4d16-b61e-a91474b9d6c9" />
1 parent 72f5763 commit 306b7f6

File tree

1 file changed

+43
-9
lines changed

1 file changed

+43
-9
lines changed

packages/next/src/views/API/RenderJSON/index.scss

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
@import '~@payloadcms/ui/scss';
22

3-
$tab-width: 16px;
3+
$tab-width: 24px;
44

55
@layer payload-default {
66
.query-inspector {
7+
--tab-width: 24px;
8+
79
&__json-children {
810
position: relative;
911

1012
&--nested {
1113
& li {
12-
padding-left: $tab-width;
14+
padding-left: 8px;
1315
}
1416
}
1517

@@ -23,6 +25,14 @@ $tab-width: 16px;
2325
}
2426
}
2527

28+
&__row-line {
29+
&--nested {
30+
.query-inspector__json-children {
31+
padding-left: var(--tab-width);
32+
}
33+
}
34+
}
35+
2636
&__list-wrap {
2737
position: relative;
2838
}
@@ -37,10 +47,16 @@ $tab-width: 16px;
3747
border-bottom-right-radius: 0;
3848
position: relative;
3949
display: flex;
40-
gap: 10px;
50+
column-gap: 14px;
51+
row-gap: 10px;
4152
align-items: center;
42-
left: -3px;
53+
left: 0;
4354
width: calc(100% + 3px);
55+
background-color: var(--theme-elevation-50);
56+
57+
&:not(.query-inspector__list-toggle--empty) {
58+
margin-left: calc(var(--tab-width) * -1 - 10px);
59+
}
4460

4561
svg .stroke {
4662
stroke: var(--theme-elevation-400);
@@ -82,14 +98,32 @@ $tab-width: 16px;
8298
&__bracket {
8399
position: relative;
84100

85-
&--nested {
86-
margin-left: $tab-width;
87-
}
88-
89101
&--position-end {
90-
left: 1px;
102+
left: 2px;
91103
width: calc(100% - 5px);
92104
}
93105
}
106+
107+
// Some specific rules targetting the very top of the nested JSON structure or very first items since they need slightly different styling
108+
&__results {
109+
& > .query-inspector__row-line--nested {
110+
& > .query-inspector__list-toggle {
111+
margin-left: 0;
112+
column-gap: 6px;
113+
114+
.query-inspector__toggle-row-icon {
115+
margin-left: -4px;
116+
}
117+
}
118+
119+
& > .query-inspector__json-children {
120+
padding-left: calc(var(--base) * 1);
121+
}
122+
123+
& > .query-inspector__bracket--nested > .query-inspector__bracket--position-end {
124+
padding-left: 16px;
125+
}
126+
}
127+
}
94128
}
95129
}

0 commit comments

Comments
 (0)