feat(component): 재사용 타이틀 탭 바를 추가한다
This commit is contained in:
39
SodaLive/Sources/V2/Component/DefaultTitleBar.swift
Normal file
39
SodaLive/Sources/V2/Component/DefaultTitleBar.swift
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// DefaultTitleBar.swift
|
||||
// SodaLive
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct DefaultTitleBar<Menu: View>: View {
|
||||
let title: String
|
||||
private let menu: Menu
|
||||
|
||||
init(
|
||||
title: String,
|
||||
@ViewBuilder menu: () -> Menu
|
||||
) {
|
||||
self.title = title
|
||||
self.menu = menu()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
TitleBar {
|
||||
Text(title)
|
||||
.appFont(.heading2)
|
||||
.foregroundColor(.white)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
} trailing: {
|
||||
menu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DefaultTitleBar_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
DefaultTitleBar(title: "화면명") {
|
||||
Image("ic_bar_search")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user