diff --git a/Sources/DashUIKit/Components/BottomSheet/BottomSheet.swift b/Sources/DashUIKit/Components/BottomSheet/BottomSheet.swift index 06edb3f..b824c91 100644 --- a/Sources/DashUIKit/Components/BottomSheet/BottomSheet.swift +++ b/Sources/DashUIKit/Components/BottomSheet/BottomSheet.swift @@ -124,7 +124,7 @@ public struct BottomSheet: View { hasCustomCloseAction: onClose != nil) } - /// A header with no title, no back button and no close button is 64pt of + /// A header with no title, no back button and no close button is 74pt of /// nothing: it pushes the content down, and on a self-sizing sheet that /// blank strip becomes part of the sheet's own measured height. Collapse /// it rather than reserve it. Any one of the three brings it back, and the @@ -142,7 +142,7 @@ public struct BottomSheet: View { }, central: { Text(title) - .dashFont(.calloutMedium) + .dashFont(.subheadMedium) .foregroundColor(.dash.primaryText) }, trailing: { diff --git a/Sources/DashUIKit/Components/NavigationBar.swift b/Sources/DashUIKit/Components/NavigationBar.swift index 0b4ef96..fe9c0e0 100644 --- a/Sources/DashUIKit/Components/NavigationBar.swift +++ b/Sources/DashUIKit/Components/NavigationBar.swift @@ -46,7 +46,7 @@ public struct NavigationBar: View central } - .frame(maxWidth: .infinity, minHeight: 64) + .frame(maxWidth: .infinity, minHeight: 74) } } @@ -99,17 +99,33 @@ public enum NavigationBarElement: String { case plus = "navigationbar-plus" case info = "navigationbar-info" + /// The element as drawn in the bar. `back`, `close` and `plus` are a glyph + /// centred in a stroked circle; `info` is a self-contained icon. + @ViewBuilder public var icon: some View { + switch self { + case .back, .close, .plus: + glyph + .foregroundColor(.dash.toolbarRoundContent) + .frame(width: 34, height: 34) + .overlay( + Circle() + .strokeBorder(Color.dash.toolbarRoundBorder, lineWidth: 1.5) + ) + case .info: + glyph + } + } + + private var glyph: some View { Image(dash: .custom(rawValue, bundle: .module)) - .resizable() - .scaledToFit() + .fixedSize() } public func button(action: @escaping () -> Void) -> some View { Button(action: action) { icon - .fixedSize() - .frame(width: 44, height: 44, alignment: .center) + .frame(height: 44) .contentShape(Rectangle()) } .buttonStyle(NavigationBarButtonStyle()) diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/Contents.json b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/Contents.json index 043b59c..a23f511 100644 --- a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/Contents.json +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/Contents.json @@ -1,19 +1,8 @@ { "images" : [ { - "filename" : "navigationbar-back@1x.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "navigationbar-back@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "navigationbar-back@3x.png", - "idiom" : "universal", - "scale" : "3x" + "filename" : "navigationbar-back.svg", + "idiom" : "universal" } ], "info" : { @@ -21,6 +10,7 @@ "version" : 1 }, "properties" : { + "preserves-vector-representation" : true, "template-rendering-intent" : "template" } } diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back.svg b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back.svg new file mode 100644 index 0000000..2e24e36 --- /dev/null +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back.svg @@ -0,0 +1,3 @@ + + + diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@1x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@1x.png deleted file mode 100644 index f982683..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@1x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@2x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@2x.png deleted file mode 100644 index 031065d..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@2x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@3x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@3x.png deleted file mode 100644 index 3b5987b..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-back.imageset/navigationbar-back@3x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/Contents.json b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/Contents.json index 9927bcb..76b531e 100644 --- a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/Contents.json +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/Contents.json @@ -1,19 +1,8 @@ { "images" : [ { - "filename" : "navigationbar-close@1x.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "navigationbar-close@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "navigationbar-close@3x.png", - "idiom" : "universal", - "scale" : "3x" + "filename" : "navigationbar-close.svg", + "idiom" : "universal" } ], "info" : { @@ -21,7 +10,7 @@ "version" : 1 }, "properties" : { - "localizable" : true, + "preserves-vector-representation" : true, "template-rendering-intent" : "template" } } diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close.svg b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close.svg new file mode 100644 index 0000000..4b127e1 --- /dev/null +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@1x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@1x.png deleted file mode 100644 index 9926297..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@1x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@2x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@2x.png deleted file mode 100644 index eb5afcd..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@2x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@3x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@3x.png deleted file mode 100644 index 469d34f..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-close.imageset/navigationbar-close@3x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/Contents.json b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/Contents.json index 328805f..6d1cf8d 100644 --- a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/Contents.json +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/Contents.json @@ -1,23 +1,16 @@ { "images" : [ { - "filename" : "control-info.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "control-info@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "control-info@3x.png", - "idiom" : "universal", - "scale" : "3x" + "filename" : "navigationbar-info.svg", + "idiom" : "universal" } ], "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "original" } } diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info.png deleted file mode 100644 index cc2aeb1..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info@2x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info@2x.png deleted file mode 100644 index 4d6aacd..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info@2x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info@3x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info@3x.png deleted file mode 100644 index 0bfb1e8..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/control-info@3x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/navigationbar-info.svg b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/navigationbar-info.svg new file mode 100644 index 0000000..babec16 --- /dev/null +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-info.imageset/navigationbar-info.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/Contents.json b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/Contents.json index 5205881..a4fb171 100644 --- a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/Contents.json +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/Contents.json @@ -1,19 +1,8 @@ { "images" : [ { - "filename" : "navigationbar-plus@1x.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "navigationbar-plus@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "navigationbar-plus@3x.png", - "idiom" : "universal", - "scale" : "3x" + "filename" : "navigationbar-plus.svg", + "idiom" : "universal" } ], "info" : { @@ -21,7 +10,7 @@ "version" : 1 }, "properties" : { - "localizable" : true, + "preserves-vector-representation" : true, "template-rendering-intent" : "template" } } diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus.svg b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus.svg new file mode 100644 index 0000000..bbd0759 --- /dev/null +++ b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@1x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@1x.png deleted file mode 100644 index 9ef0c5c..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@1x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@2x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@2x.png deleted file mode 100644 index a4ad7a8..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@2x.png and /dev/null differ diff --git a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@3x.png b/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@3x.png deleted file mode 100644 index 9f464cb..0000000 Binary files a/Sources/DashUIKit/Resources/Media.xcassets/Icons & Illustrations/Navigation bar/navigationbar-plus.imageset/navigationbar-plus@3x.png and /dev/null differ diff --git a/docs/navigation-and-containers.md b/docs/navigation-and-containers.md index eb2a68d..8798542 100644 --- a/docs/navigation-and-containers.md +++ b/docs/navigation-and-containers.md @@ -11,7 +11,7 @@ File `Components/NavigationBar.swift` · `@available(iOS 14, macOS 11, *)` A custom three-slot top bar: **leading**, **central**, **trailing**, each a `@ViewBuilder`. The leading/trailing pair is laid out in an `HStack` with a `Spacer` between; the central content is overlaid centered (so a long title stays centered -regardless of side content). Min height 64. +regardless of side content). Min height 74. ```swift NavigationBar( @@ -31,8 +31,11 @@ Convenience initializers let you omit any slot (e.g. only `leading`, or `central **`NavigationBarElement`** — bundled icon buttons backed by the nav assets: `.back`, `.close`, `.plus`, `.info`. Each provides: -- `.icon` — the resizable `Image`. -- `.button(action:)` — a 44×44 tappable button with a press animation +- `.icon` — the element as drawn. `.back`, `.close` and `.plus` are a vector glyph + (`Color.dash.toolbarRoundContent`) centred in a 34×34 circle with a 1.5pt + `Color.dash.toolbarRoundBorder` stroke, so both adapt to light/dark mode. + `.info` is a self-contained 24×24 icon. +- `.button(action:)` — the icon in a tappable area 44pt tall and as wide as the icon, with a press animation (scale 0.88 + opacity 0.7). ---