restores Helder in all its glory
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import SwiftUI
|
||||
|
||||
/// The 10pt uppercase mono label over a panel or section, with an optional amber count.
|
||||
public struct PanelLabel: View {
|
||||
var title: String
|
||||
var count: Int?
|
||||
|
||||
public init(_ title: String, count: Int? = nil) {
|
||||
self.title = title
|
||||
self.count = count
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
HStack {
|
||||
Text(title).typeRole(Typography.panelLabel).foregroundStyle(Palette.text4)
|
||||
Spacer()
|
||||
if let count {
|
||||
Text("\(count)").typeRole(Typography.panelLabel).foregroundStyle(Palette.amber)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A column's header bar: the panel label left, optional trailing content, hairline below.
|
||||
/// Use it at the top of Explorer, Source Control groups and code panels.
|
||||
public struct PanelHeader<Trailing: View>: View {
|
||||
var title: String
|
||||
var height: CGFloat
|
||||
var trailing: Trailing
|
||||
|
||||
public init(_ title: String, height: CGFloat = Metrics.panelHeader, @ViewBuilder trailing: () -> Trailing) {
|
||||
self.title = title
|
||||
self.height = height
|
||||
self.trailing = trailing()
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
HStack(spacing: 8) {
|
||||
Text(title).typeRole(Typography.panelLabel).foregroundStyle(Palette.text4)
|
||||
Spacer(minLength: 8)
|
||||
trailing
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.frame(height: height)
|
||||
.hairline(.bottom)
|
||||
}
|
||||
}
|
||||
|
||||
extension PanelHeader where Trailing == EmptyView {
|
||||
public init(_ title: String, height: CGFloat = Metrics.panelHeader) {
|
||||
self.init(title, height: height) { EmptyView() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user