feat(component): 재사용 타이틀 탭 바를 추가한다
This commit is contained in:
45
SodaLive/Sources/V2/Component/TitleBar.swift
Normal file
45
SodaLive/Sources/V2/Component/TitleBar.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// 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")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user