46 lines
974 B
Swift
46 lines
974 B
Swift
//
|
|
// TitleBar.swift
|
|
// SodaLive
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TitleBar<Leading: View, Trailing: View>: View {
|
|
private let leading: Leading
|
|
private let trailing: Trailing
|
|
|
|
init(
|
|
@ViewBuilder leading: () -> Leading,
|
|
@ViewBuilder trailing: () -> Trailing
|
|
) {
|
|
self.leading = leading()
|
|
self.trailing = trailing()
|
|
}
|
|
|
|
var body: some View {
|
|
HStack(alignment: .center, spacing: 0) {
|
|
leading
|
|
|
|
Spacer(minLength: 0)
|
|
|
|
trailing
|
|
}
|
|
.padding(.horizontal, SodaSpacing.s20)
|
|
.frame(maxWidth: .infinity)
|
|
.frame(height: 60, alignment: .center)
|
|
.background(Color.black)
|
|
}
|
|
}
|
|
|
|
struct TitleBar_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
TitleBar {
|
|
Text("Title")
|
|
.appFont(.heading3)
|
|
.foregroundColor(.white)
|
|
} trailing: {
|
|
Image("ic_bar_search")
|
|
}
|
|
}
|
|
}
|