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)) 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) + } +}