From af0656708bbfb1cc51907136501a8f0f7f0a3c1a Mon Sep 17 00:00:00 2001 From: Alexander Romanov Date: Mon, 24 Jul 2023 23:27:39 +0300 Subject: [PATCH 1/2] Fix avatar image scale --- Sources/OversizeUI/Controls/Avatar/Avatar.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/OversizeUI/Controls/Avatar/Avatar.swift b/Sources/OversizeUI/Controls/Avatar/Avatar.swift index a53b17f..60dd3ab 100644 --- a/Sources/OversizeUI/Controls/Avatar/Avatar.swift +++ b/Sources/OversizeUI/Controls/Avatar/Avatar.swift @@ -101,6 +101,7 @@ public struct Avatar: View { if let avatar { avatar .resizable() + .scaledToFill() .frame(width: Space.xxxLarge.rawValue, height: Space.xxxLarge.rawValue) .clipShape(Circle()) .overlay(Circle().stroke(strokeColor, lineWidth: 2)) From 40395ffd1688b3d3e686ecc859b18cceacc721b9 Mon Sep 17 00:00:00 2001 From: Alexander Romanov Date: Tue, 25 Jul 2023 22:40:39 +0300 Subject: [PATCH 2/2] Added KeyboardToolbar --- .../KeyboardToolbar/KeyboardToolbar.swift | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Sources/OversizeUI/Controls/KeyboardToolbar/KeyboardToolbar.swift diff --git a/Sources/OversizeUI/Controls/KeyboardToolbar/KeyboardToolbar.swift b/Sources/OversizeUI/Controls/KeyboardToolbar/KeyboardToolbar.swift new file mode 100644 index 0000000..b66ddfc --- /dev/null +++ b/Sources/OversizeUI/Controls/KeyboardToolbar/KeyboardToolbar.swift @@ -0,0 +1,50 @@ +// +// Copyright © 2021 Alexander Romanov +// KeyboardToolbar.swift, created on 25.07.2023 +// + +import SwiftUI + +public struct KeyboardToolbar: View where A: View { + private let actions: Group? + private let doneAction: (() -> Void)? + + public init( + @ViewBuilder actions: @escaping () -> A, + doneAction: (() -> Void)? = nil + ) { + self.actions = Group { actions() } + self.doneAction = doneAction + } + + public var body: some View { + HStack(spacing: .xSmall) { + if actions != nil { + HStack(spacing: .xxxSmall) { + actions + .buttonStyle(.quaternary) + .controlBorderShape(.capsule) + .controlSize(.mini) + } + } + + Spacer() + + if doneAction != nil { + Button { + doneAction?() + } label: { + Text("Done") + } + .buttonStyle(.quaternary) + .controlBorderShape(.capsule) + .accent() + .controlSize(.mini) + } + } + .padding(.horizontal, .small) + .padding(.vertical, .xxSmall) + .background(Color.surfacePrimary) + .shadowElevaton(.z1) + } +}