@@ -103,7 +103,7 @@ struct ToolbarBranchPicker: View {
103103 var body : some View {
104104 VStack ( alignment: . leading) {
105105 if let currentBranch = sourceControlManager. currentBranch {
106- VStack ( alignment : . leading , spacing : 0 ) {
106+ Section {
107107 headerLabel ( " Current Branch " )
108108 BranchCell ( sourceControlManager: sourceControlManager, branch: currentBranch, active: true )
109109 }
@@ -123,7 +123,7 @@ struct ToolbarBranchPicker: View {
123123 }
124124
125125 if !branches. isEmpty {
126- VStack ( alignment : . leading , spacing : 0 ) {
126+ Section {
127127 headerLabel ( " Branches " )
128128 ForEach ( branchesGroups. keys. sorted ( ) , id: \. self) { branchGroupPrefix in
129129 if let group = branchesGroups [ branchGroupPrefix] {
@@ -144,7 +144,10 @@ struct ToolbarBranchPicker: View {
144144 )
145145 }
146146 } , label: {
147- Text ( group. name)
147+ HStack {
148+ Image ( systemName: " folder " )
149+ Text ( group. name)
150+ }
148151 } )
149152 }
150153 }
@@ -173,9 +176,9 @@ struct ToolbarBranchPicker: View {
173176 /// A Button Cell that represents a branch in the branch picker
174177 struct BranchCell : View {
175178 let sourceControlManager : SourceControlManager
176- var branch : GitBranch
179+ let branch : GitBranch
180+ let active : Bool
177181 let title : String ?
178- var active : Bool = false
179182
180183 init (
181184 sourceControlManager: SourceControlManager ,
@@ -192,37 +195,18 @@ struct ToolbarBranchPicker: View {
192195 @Environment ( \. dismiss)
193196 private var dismiss
194197
195- @State private var isHovering : Bool = false
196-
197198 var body : some View {
198199 Button {
199200 switchBranch ( )
200201 } label: {
201202 HStack {
202- Label {
203- Text ( self . title ?? branch. name)
204- . frame ( maxWidth: . infinity, alignment: . leading)
205- } icon: {
206- Image . checkout
207- . imageScale ( . large)
208- }
209- . foregroundColor ( isHovering ? . white : . secondary)
210203 if active {
211204 Image ( systemName: " checkmark.circle.fill " )
212- . foregroundColor ( isHovering ? . white : . green)
205+ } else {
206+ Image . checkout
213207 }
208+ Text ( self . title ?? branch. name)
214209 }
215- . contentShape ( Rectangle ( ) )
216- }
217- . buttonStyle ( . plain)
218- . padding ( . horizontal)
219- . padding ( . vertical, 10 )
220- . background (
221- EffectView . selectionBackground ( isHovering)
222- )
223- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
224- . onHover { active in
225- isHovering = active
226210 }
227211 }
228212
0 commit comments