From 4e825fadcb51f81cc444f7df26b9a71997874095 Mon Sep 17 00:00:00 2001 From: Alexandr Romanov Date: Sat, 9 Nov 2024 20:40:36 +0300 Subject: [PATCH] Add HUD autoHide and format --- Sources/OversizeUI/Controls/HUD/HUD.swift | 4 +- .../OversizeUI/Controls/Surface/Surface.swift | 2 +- Sources/OversizeUI/Core/Typography.swift | 38 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Sources/OversizeUI/Controls/HUD/HUD.swift b/Sources/OversizeUI/Controls/HUD/HUD.swift index ad1248c..c085fab 100644 --- a/Sources/OversizeUI/Controls/HUD/HUD.swift +++ b/Sources/OversizeUI/Controls/HUD/HUD.swift @@ -197,9 +197,9 @@ public extension View { } #else public extension View { - func hud(_ text: String, isPresented: Binding) -> some View { + func hud(_ text: String, autoHide: Bool = true, isPresented: Binding) -> some View { overlay(alignment: .top) { - HUD(text, isPresented: isPresented) + HUD(text, autoHide: autoHide, isPresented: isPresented) } } diff --git a/Sources/OversizeUI/Controls/Surface/Surface.swift b/Sources/OversizeUI/Controls/Surface/Surface.swift index 3e4b68f..52ccd2d 100644 --- a/Sources/OversizeUI/Controls/Surface/Surface.swift +++ b/Sources/OversizeUI/Controls/Surface/Surface.swift @@ -199,7 +199,7 @@ public struct SurfaceButtonStyle: ButtonStyle { public func makeBody(configuration: Self.Configuration) -> some View { configuration.label #if os(macOS) - .scaleEffect(configuration.isPressed ? 0.98 : 1) + .scaleEffect(configuration.isPressed ? 0.99 : 1) #else .scaleEffect(configuration.isPressed ? 0.96 : 1) #endif diff --git a/Sources/OversizeUI/Core/Typography.swift b/Sources/OversizeUI/Core/Typography.swift index 65254ab..427aa77 100644 --- a/Sources/OversizeUI/Core/Typography.swift +++ b/Sources/OversizeUI/Core/Typography.swift @@ -44,26 +44,26 @@ public struct Typography: ViewModifier { #if os(macOS) private var lineHeight: CGFloat { switch fontStyle { - case .largeTitle: return 32 - case .title: return 28 - case .title2: return 24 - case .title3: return 20 - case .headline: return 16 - case .subheadline: return 20 - case .body, .callout, .footnote, .caption, .caption2: return 16 - default: return 16 + case .largeTitle: 32 + case .title: 28 + case .title2: 24 + case .title3: 20 + case .headline: 16 + case .subheadline: 20 + case .body, .callout, .footnote, .caption, .caption2: 16 + default: 16 } } #else private var lineHeight: CGFloat { switch fontStyle { - case .largeTitle: return 44 - case .title: return 36 - case .title2: return 28 - case .title3, .headline: return 24 - case .subheadline, .body: return 20 - case .callout, .footnote, .caption, .caption2: return 16 - default: return 16 + case .largeTitle: 44 + case .title: 36 + case .title2: 28 + case .title3, .headline: 24 + case .subheadline, .body: 20 + case .callout, .footnote, .caption, .caption2: 16 + default: 16 } } #endif @@ -71,13 +71,13 @@ public struct Typography: ViewModifier { private var fontDesign: Font.Design { switch fontStyle { case .largeTitle, .title, .title2, .title3, .headline, .subheadline: - return theme.fontTitle.system + theme.fontTitle.system case .body: - return theme.fontParagraph.system + theme.fontParagraph.system case .caption, .caption2, .footnote, .callout: - return theme.fontOverline.system + theme.fontOverline.system default: - return .default + .default } }