Skip to content

Commit ce3dd04

Browse files
committed
Finish Up Toolbar Look
1 parent 4533a94 commit ce3dd04

File tree

5 files changed

+73
-28
lines changed

5 files changed

+73
-28
lines changed

CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabBackground.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ struct EditorTabBackground: View {
2929
ZStack {
3030
if isActive {
3131
// Content background (visible if active)
32-
EffectView(.contentBackground)
33-
.opacity(isActive ? 1 : 0)
32+
if #available(macOS 26, *) {
33+
GlassEffectView()
34+
} else {
35+
EffectView(.contentBackground)
36+
}
3437

3538
// Accent color (visible if active)
3639
Color(.controlAccentColor)

CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabCloseButton.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ struct EditorTabCloseButton: View {
4242
.frame(width: buttonSize, height: buttonSize)
4343
.background(backgroundColor)
4444
.foregroundColor(isPressingClose ? .primary : .secondary)
45-
.clipShape(RoundedRectangle(cornerRadius: 2))
45+
.if(.tahoe) {
46+
$0.clipShape(Circle())
47+
} else: {
48+
$0.clipShape(RoundedRectangle(cornerRadius: 2))
49+
}
4650
.contentShape(Rectangle())
4751
.gesture(
4852
DragGesture(minimumDistance: 0)

CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabView.swift

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ struct EditorTabView: View {
120120

121121
@ViewBuilder var content: some View {
122122
HStack(spacing: 0.0) {
123-
EditorTabDivider()
124-
.opacity(
125-
(isActive || inHoldingState) ? 0.0 : 1.0
126-
)
123+
124+
if #unavailable(macOS 26) {
125+
EditorTabDivider()
126+
.opacity((isActive || inHoldingState) ? 0.0 : 1.0)
127+
}
127128
// Tab content (icon and text).
128129
HStack(alignment: .center, spacing: 3) {
129130
Image(nsImage: tabFile.nsIcon)
@@ -163,14 +164,19 @@ struct EditorTabView: View {
163164
}
164165
.frame(maxWidth: .infinity, alignment: .leading)
165166
}
167+
.if(.tahoe) {
168+
$0.padding(.horizontal, 1.5)
169+
}
166170
.opacity(
167171
// Inactive states for tab bar item content.
168172
activeState != .inactive
169173
? 1.0
170174
: isActive ? 0.6 : 0.4
171175
)
172-
EditorTabDivider()
173-
.opacity((isActive || inHoldingState) ? 0.0 : 1.0)
176+
if #unavailable(macOS 26) {
177+
EditorTabDivider()
178+
.opacity((isActive || inHoldingState) ? 0.0 : 1.0)
179+
}
174180
}
175181
.foregroundColor(
176182
isActive && isActiveEditor
@@ -202,6 +208,11 @@ struct EditorTabView: View {
202208
EditorTabBackground(isActive: isActive, isPressing: isPressing, isDragging: isDragging)
203209
.animation(.easeInOut(duration: 0.08), value: isHovering)
204210
}
211+
.if(.tahoe) {
212+
if #available(macOS 26, *) {
213+
$0.clipShape(Capsule()).clipped().containerShape(Capsule())
214+
}
215+
}
205216
// TODO: Enable the following code snippet when dragging-out behavior should be allowed.
206217
// Since we didn't handle the drop-outside event, dragging-out is disabled for now.
207218
// .onDrag({

CodeEdit/Features/Editor/TabBar/Tabs/Views/EditorTabs.swift

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ struct EditorTabs: View {
260260
) {
261261
ForEach(Array(openedTabs.enumerated()), id: \.element) { index, id in
262262
if let item = editor.tabs.first(where: { $0.file.id == id }) {
263+
if index != 0
264+
&& editor.selectedTab?.file.id != id
265+
&& editor.selectedTab?.file.id != openedTabs[index - 1] {
266+
EditorTabDivider()
267+
}
268+
263269
EditorTabView(
264270
file: item.file,
265271
index: index,
@@ -293,6 +299,12 @@ struct EditorTabs: View {
293299
tabWidth: $tabWidth
294300
)
295301
)
302+
303+
if index < openedTabs.count - 1
304+
&& editor.selectedTab?.file.id != id
305+
&& editor.selectedTab?.file.id != openedTabs[index + 1] {
306+
EditorTabDivider()
307+
}
296308
}
297309
}
298310
}
@@ -341,26 +353,33 @@ struct EditorTabs: View {
341353
// To fill up the parent space of tab bar.
342354
.frame(maxWidth: .infinity)
343355
}
356+
.overlay(alignment: .leading) {
357+
EditorTabsOverflowShadow(
358+
width: colorScheme == .dark ? 5 : 7,
359+
startPoint: .leading,
360+
endPoint: .trailing
361+
)
362+
.opacity(scrollOffset >= 0 ? 0 : 1)
363+
}
364+
.overlay(alignment: .trailing) {
365+
EditorTabsOverflowShadow(
366+
width: colorScheme == .dark ? 5 : 7,
367+
startPoint: .trailing,
368+
endPoint: .leading
369+
)
370+
.opacity((scrollTrailingOffset ?? 0) <= 0 ? 0 : 1)
371+
}
344372
.if(.tahoe) {
345373
if #available(macOS 26.0, *) {
346-
$0.background(GlassEffectView(tintColor: .secondarySystemFill)).clipShape(Capsule())
347-
}
348-
} else: {
349-
$0.overlay(alignment: .leading) {
350-
EditorTabsOverflowShadow(
351-
width: colorScheme == .dark ? 5 : 7,
352-
startPoint: .leading,
353-
endPoint: .trailing
354-
)
355-
.opacity(scrollOffset >= 0 ? 0 : 1)
356-
}
357-
.overlay(alignment: .trailing) {
358-
EditorTabsOverflowShadow(
359-
width: colorScheme == .dark ? 5 : 7,
360-
startPoint: .trailing,
361-
endPoint: .leading
362-
)
363-
.opacity((scrollTrailingOffset ?? 0) <= 0 ? 0 : 1)
374+
// Unfortunate triple if here due to needing to compile on
375+
// earlier Xcodes.
376+
#if compiler(>=6.2)
377+
$0.background(GlassEffectView(tintColor: .tertiarySystemFill))
378+
.clipShape(Capsule())
379+
.clipped()
380+
#else
381+
$0
382+
#endif
364383
}
365384
}
366385
}

CodeEdit/Features/Editor/Views/EditorAreaView.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ struct EditorAreaView: View {
111111
EditorTabBarView(hasTopInsets: topSafeArea > 0, codeFile: fileBinding)
112112
.id("TabBarView" + editor.id.uuidString)
113113
.environmentObject(editor)
114-
Divider()
114+
if #unavailable(macOS 26) {
115+
Divider()
116+
}
115117
}
116118
if showEditorJumpBar {
117119
EditorJumpBarView(
@@ -125,6 +127,12 @@ struct EditorAreaView: View {
125127
}
126128
.environmentObject(editor)
127129
.padding(.top, shouldShowTabBar ? -1 : 0)
130+
if #unavailable(macOS 26) {
131+
Divider()
132+
}
133+
}
134+
// On Tahoe we only show one divider
135+
if #available(macOS 26, *), shouldShowTabBar || showEditorJumpBar {
128136
Divider()
129137
}
130138
}

0 commit comments

Comments
 (0)