isSelected -> isHighlighted

This commit is contained in:
Soh Satoh
2025-01-26 22:42:59 +09:00
parent ae8ddb234f
commit 27b59f7c2d
2 changed files with 4 additions and 6 deletions

View File

@ -9,8 +9,7 @@ struct QuickTerminalTabBarView: View {
ForEach(tabManager.tabs) { tab in ForEach(tabManager.tabs) { tab in
QuickTerminalTabItemView( QuickTerminalTabItemView(
tab: tab, tab: tab,
isSelected: tab.isActive, isHighlighted: tab.isActive,
isSingleTab: tabManager.tabs.count == 1,
onSelect: { tabManager.selectTab(tab) }, onSelect: { tabManager.selectTab(tab) },
onClose: { tabManager.closeTab(tab) } onClose: { tabManager.closeTab(tab) }
) )

View File

@ -2,8 +2,7 @@ import SwiftUI
struct QuickTerminalTabItemView: View { struct QuickTerminalTabItemView: View {
@ObservedObject var tab: QuickTerminalTab @ObservedObject var tab: QuickTerminalTab
let isSelected: Bool let isHighlighted: Bool
let isSingleTab: Bool
let onSelect: () -> Void let onSelect: () -> Void
let onClose: () -> Void let onClose: () -> Void
@ -21,7 +20,7 @@ struct QuickTerminalTabItemView: View {
.animation(.easeInOut, value: isHovered) .animation(.easeInOut, value: isHovered)
Text(tab.title) Text(tab.title)
.foregroundColor(isSelected ? .primary : .secondary) .foregroundColor(isHighlighted ? .primary : .secondary)
.lineLimit(1) .lineLimit(1)
.truncationMode(.tail) .truncationMode(.tail)
.frame(minWidth: 0, maxWidth: .infinity) .frame(minWidth: 0, maxWidth: .infinity)
@ -31,7 +30,7 @@ struct QuickTerminalTabItemView: View {
.background( .background(
Rectangle() Rectangle()
.fill( .fill(
isSelected && !isSingleTab isHighlighted
? Color(NSColor.controlBackgroundColor) ? Color(NSColor.controlBackgroundColor)
: (isHovered ? Color(NSColor.underPageBackgroundColor) : Color(NSColor.windowBackgroundColor))) : (isHovered ? Color(NSColor.underPageBackgroundColor) : Color(NSColor.windowBackgroundColor)))
) )