Skip to content

Commit e6bb79b

Browse files
authored
Update styles for language toggle (#781)
* [rdar://122676572] fix: Update styles for language toggle * [rdar://122676572] Apply underline styles to nav-menu-link * [rdar://122676572] Adjust border under the nav to the bottom * Update calculateSelectWidth * Fix color for language toggle border [rdar://122676572]
1 parent e87a72d commit e6bb79b

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

src/components/DocumentationTopic/DocumentationNav.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ $sidenav-icon-padding-size: 5px;
150150
margin-left: 0;
151151
min-width: 0;
152152
153-
.nav-menu-link, .current-language, span {
153+
.nav-menu-link {
154154
font-weight: $font-weight-semibold;
155+
@include underline-text;
155156
}
156157
157158
&:first-child:not(:only-child) {
@@ -168,7 +169,7 @@ $sidenav-icon-padding-size: 5px;
168169
169170
@include nav-in-breakpoint() {
170171
&:not(:first-child) {
171-
border-top: 1px solid dark-color(fill-gray-tertiary);
172+
border-top: 1px solid var(--color-fill-gray-tertiary);
172173
}
173174
}
174175
}

src/components/DocumentationTopic/DocumentationNav/LanguageToggle.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export default {
190190
async calculateSelectWidth() {
191191
// await next tick, so we are sure the element is rendered.
192192
await this.$nextTick();
193-
this.adjustedWidth = this.$refs['language-sizer'].clientWidth + 6;
193+
this.adjustedWidth = this.$refs['language-sizer'].clientWidth + 8;
194194
},
195195
},
196196
computed: {
@@ -229,6 +229,7 @@ $dropdown-icon-padding: 11px;
229229
$nav-menu-toggle-label-margin: 6px;
230230
231231
.nav-menu-setting-label {
232+
display: inline-block;
232233
margin-right: $nav-menu-label-margin;
233234
white-space: nowrap;
234235
}
@@ -315,7 +316,7 @@ $nav-menu-toggle-label-margin: 6px;
315316
display: inline-block;
316317
317318
&:not(:first-child) {
318-
border-left: 1px solid dark-color(fill-gray-tertiary);
319+
border-left: 1px solid var(--color-grid);
319320
margin-left: $nav-menu-toggle-label-margin;
320321
padding-left: $nav-menu-toggle-label-margin;
321322
}

src/components/NavBase.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ $content-max-width: map-deep-get($breakpoint-attributes, (nav, large, content-wi
495495
content: "";
496496
display: block;
497497
position: absolute;
498-
top: 100%;
498+
bottom: 0;
499499
left: 50%;
500500
transform: translateX(-50%);
501501
width: $content-max-width;

src/styles/core/_nav.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ $nav-z-index: 9997;
6262
$nav-chevron-angle: 40deg;
6363
$nav-chevron-thickness: 1.5;
6464
$nav-chevron-transition: 0.3s linear transform;
65-
$nav-menu-label-margin: rem(6px);
65+
$nav-menu-label-margin: rem(5px);
6666

6767
// Apply styles to animate the nav chevron downwards
6868
@mixin nav-chevron-animation {

tests/unit/components/DocumentationTopic/DocumentationNav/LanguageToggle.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ describe('LanguageToggle', () => {
100100
const sizer = wrapper.find({ ref: 'language-sizer' }).element;
101101
const toggle = wrapper.find('#language-toggle');
102102
// clientWidth is now 0
103-
expect(toggle.attributes()).toHaveProperty('style', 'width: 6px;');
103+
expect(toggle.attributes()).toHaveProperty('style', 'width: 8px;');
104104
Object.defineProperty(sizer, 'clientWidth', {
105105
get: () => 20,
106106
});
107107
toggle.setValue(Language.objectiveC.key.api);
108108
await wrapper.vm.$nextTick();
109-
expect(toggle.attributes()).toHaveProperty('style', 'width: 26px;');
109+
expect(toggle.attributes()).toHaveProperty('style', 'width: 28px;');
110110
});
111111

112112
it('applies the faux select width on the language toggle, on screen resize', async () => {
@@ -116,12 +116,12 @@ describe('LanguageToggle', () => {
116116
get: () => 20,
117117
});
118118
// clientWidth was 0
119-
expect(toggle.attributes()).toHaveProperty('style', 'width: 6px;');
119+
expect(toggle.attributes()).toHaveProperty('style', 'width: 8px;');
120120
const resizeEvent = createEvent('resize');
121121
window.dispatchEvent(resizeEvent);
122122
await wrapper.vm.$nextTick();
123123
await flushPromises();
124-
expect(toggle.attributes()).toHaveProperty('style', 'width: 26px;');
124+
expect(toggle.attributes()).toHaveProperty('style', 'width: 28px;');
125125
});
126126

127127
it('applies the faux select width on the language toggle, on orientationchange', async () => {
@@ -131,11 +131,11 @@ describe('LanguageToggle', () => {
131131
get: () => 20,
132132
});
133133
// clientWidth was 0
134-
expect(toggle.attributes()).toHaveProperty('style', 'width: 6px;');
134+
expect(toggle.attributes()).toHaveProperty('style', 'width: 8px;');
135135
const orientationchangeEvent = createEvent('orientationchange');
136136
window.dispatchEvent(orientationchangeEvent);
137137
await flushPromises();
138-
expect(toggle.attributes()).toHaveProperty('style', 'width: 26px;');
138+
expect(toggle.attributes()).toHaveProperty('style', 'width: 28px;');
139139
});
140140

141141
it('does not render the chevron if it has no languages', () => {

0 commit comments

Comments
 (0)