Skip to content

Commit d6f0091

Browse files
JarrodMFleschCopilot
andauthored
feat(ui): restyle tabs field with design tokens to match v4 design (#16428)
## Summary Migrates the Tabs field component to use design tokens and updates visual styling to match the v4 design system. The tab indicator is now a 3px rounded pill that straddles the border line, with distinct states for active (blue), hover (translucent), and error (red). Typography uses `--text-body-medium` tokens, and spacing uses `--spacer-*` variables throughout. Also fixes ErrorPill to use `--radius-medium` (rounded square) instead of `--radius-full` (circle). **Ref:** https://app.asana.com/1/10497086658021/project/1213409914712008/task/1214061555627422?focus=true Co-authored-by: Copilot <copilot@github.com>
1 parent 76ee267 commit d6f0091

4 files changed

Lines changed: 149 additions & 48 deletions

File tree

packages/ui/src/elements/ErrorPill/index.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@
1919

2020
.error-pill--fixed-width {
2121
width: var(--spacer-3);
22-
height: var(--spacer-3);
23-
border-radius: var(--radius-full);
24-
position: relative;
25-
}
26-
27-
.error-pill__count {
28-
letter-spacing: 0.5px;
29-
margin-left: 0.5px;
3022
padding: 0;
31-
border-radius: var(--radius-full);
23+
position: relative;
3224
}
3325
}
Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
@layer payload-default {
22
.tabs-field__tab-button {
33
display: flex;
4-
padding-bottom: 1.25rem;
4+
align-items: center;
5+
justify-content: center;
6+
gap: var(--spacer-1);
7+
padding: var(--spacer-1) var(--spacer-2) var(--spacer-2-5);
58
margin: 0;
6-
margin-inline-end: 1.25rem;
79
cursor: pointer;
8-
opacity: 0.5;
910
position: relative;
1011
white-space: nowrap;
1112
flex-shrink: 0;
12-
gap: 0.625rem;
1313
outline: none;
14-
15-
&:last-child {
16-
margin: 0;
17-
}
14+
font-family: var(--text-body-medium-font-family);
15+
font-size: var(--text-body-medium-font-size);
16+
font-weight: var(--text-body-medium-font-weight);
17+
line-height: var(--text-body-medium-line-height);
18+
letter-spacing: var(--text-letter-spacing);
19+
color: var(--text-default-secondary);
1820

1921
&:after {
20-
content: ' ';
22+
content: '';
2123
position: absolute;
22-
right: 0;
24+
left: var(--spacer-2);
25+
right: var(--spacer-2);
2326
bottom: -1px;
24-
left: 0;
25-
height: 1px;
26-
background: var(--text-default);
27+
height: 3px;
28+
background: var(--icon-brand);
29+
border-radius: var(--radius-full);
2730
opacity: 0;
31+
z-index: 1;
2832
}
2933

3034
&:hover {
31-
opacity: 0.75;
32-
3335
&:after {
34-
opacity: 0.2;
36+
background: var(--bg-default-tertiary);
37+
opacity: 1;
3538
}
3639
}
3740

3841
&:focus-visible {
39-
border: 1px solid var(--border-selected-strong);
40-
border-radius: var(--radius-medium, 0.3125rem);
41-
background: var(--bg-default-secondary);
42+
outline: 1px solid var(--border-selected-default);
43+
outline-offset: -1px;
44+
border-radius: var(--radius-medium);
4245
}
4346
}
4447

@@ -47,34 +50,35 @@
4750
}
4851

4952
.tabs-field__tab-button--active {
50-
opacity: 1 !important;
53+
font-weight: var(--text-body-medium-strong-font-weight);
54+
color: var(--text-default-default);
5155

5256
&:after {
53-
opacity: 1 !important;
54-
height: 2px;
57+
background: var(--icon-brand);
58+
opacity: 1;
5559
}
56-
}
5760

58-
.tabs-field__tab-button__description {
59-
margin-bottom: var(--spacer-2);
61+
&:hover:after {
62+
background: var(--icon-brand);
63+
}
6064
}
6165

6266
.tabs-field__tab-button--has-error {
6367
color: var(--text-danger-default);
6468

6569
&:after {
66-
background: var(--text-danger-default);
70+
background: var(--border-danger-strong);
71+
opacity: 1;
72+
}
73+
74+
&:hover:after {
75+
background: var(--border-danger-strong);
6776
}
6877
}
6978

7079
@media (max-width: 768px) {
7180
.tabs-field__tab-button {
72-
margin: 0 0.9375rem 0 0;
73-
padding-bottom: 0.625rem;
74-
75-
&:last-child {
76-
margin: 0;
77-
}
81+
padding-bottom: var(--spacer-2);
7882
}
7983
}
8084
}

packages/ui/src/fields/Tabs/index.css

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@layer payload-default {
22
.tabs-field {
3-
margin-top: 2.5rem;
3+
margin-top: var(--spacer-6);
44
margin-left: calc(var(--gutter-h) * -1);
55
margin-right: calc(var(--gutter-h) * -1);
66
}
@@ -15,34 +15,47 @@
1515
}
1616

1717
.tabs-field--within-collapsible {
18-
margin: 0 calc(1.25rem * -1);
18+
margin: 0 calc(var(--spacer-4) * -1);
1919

2020
.tabs-field__content-wrap {
21-
padding-left: 1.25rem;
22-
padding-right: 1.25rem;
21+
padding-left: var(--spacer-4);
22+
padding-right: var(--spacer-4);
2323
}
2424

2525
.tabs-field__tabs {
2626
&:before,
2727
&:after {
2828
content: ' ';
2929
display: block;
30-
width: 1.25rem;
30+
width: var(--spacer-4);
3131
}
3232
}
3333
}
3434

3535
.tabs-field__tabs-wrap {
3636
overflow-x: auto;
3737
overflow-y: hidden;
38-
margin-bottom: 1.25rem;
38+
margin-bottom: var(--spacer-2-5);
39+
position: relative;
40+
padding-bottom: 2px;
41+
42+
&:after {
43+
content: '';
44+
position: absolute;
45+
bottom: 2px;
46+
left: 0;
47+
right: 0;
48+
height: 1px;
49+
background: var(--border-default-default);
50+
}
3951
}
4052

4153
.tabs-field__tabs {
42-
border-bottom: 1px solid var(--border-subtle);
4354
display: inline-flex;
4455
min-width: 100%;
4556
vertical-align: bottom;
57+
position: relative;
58+
z-index: 1;
4659

4760
&:before,
4861
&:after {

test/v4/collections/Tabs/index.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const TabsFields: CollectionConfig = {
3333
name: 'featuredImage',
3434
type: 'text',
3535
label: 'Featured Image',
36+
required: true,
3637
},
3738
],
3839
},
@@ -51,6 +52,97 @@ const TabsFields: CollectionConfig = {
5152
},
5253
],
5354
},
55+
{
56+
label: 'Settings',
57+
fields: [
58+
{
59+
name: 'publishedAt',
60+
type: 'date',
61+
label: 'Published At',
62+
},
63+
],
64+
},
65+
{
66+
label: 'Analytics',
67+
fields: [
68+
{
69+
name: 'viewCount',
70+
type: 'number',
71+
label: 'View Count',
72+
},
73+
],
74+
},
75+
{
76+
label: 'Categories',
77+
fields: [
78+
{
79+
name: 'category',
80+
type: 'text',
81+
label: 'Category',
82+
},
83+
],
84+
},
85+
{
86+
label: 'Author Info',
87+
fields: [
88+
{
89+
name: 'authorName',
90+
type: 'text',
91+
label: 'Author Name',
92+
},
93+
],
94+
},
95+
{
96+
label: 'Related Posts',
97+
fields: [
98+
{
99+
name: 'relatedPosts',
100+
type: 'text',
101+
label: 'Related Posts',
102+
},
103+
],
104+
},
105+
{
106+
label: 'Comments',
107+
fields: [
108+
{
109+
name: 'commentsEnabled',
110+
type: 'checkbox',
111+
label: 'Comments Enabled',
112+
},
113+
],
114+
},
115+
{
116+
label: 'Social Sharing',
117+
fields: [
118+
{
119+
name: 'socialImage',
120+
type: 'text',
121+
label: 'Social Image',
122+
},
123+
],
124+
},
125+
{
126+
label: 'Advanced Options',
127+
fields: [
128+
{
129+
name: 'customCSS',
130+
type: 'textarea',
131+
label: 'Custom CSS',
132+
},
133+
],
134+
},
135+
{
136+
label: 'Permissions',
137+
fields: [
138+
{
139+
name: 'visibility',
140+
type: 'select',
141+
label: 'Visibility',
142+
options: ['public', 'private', 'draft'],
143+
},
144+
],
145+
},
54146
],
55147
},
56148
],

0 commit comments

Comments
 (0)