Skip to content

Commit

Permalink
Merge pull request #33 from oversizedev/develop
Browse files Browse the repository at this point in the history
Fix avatar image scale
  • Loading branch information
aromanov91 authored Jul 25, 2023
2 parents d30c15b + 40395ff commit 0157917
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/OversizeUI/Controls/Avatar/Avatar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
50 changes: 50 additions & 0 deletions Sources/OversizeUI/Controls/KeyboardToolbar/KeyboardToolbar.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// Copyright © 2021 Alexander Romanov
// KeyboardToolbar.swift, created on 25.07.2023
//

import SwiftUI

public struct KeyboardToolbar<A>: View where A: View {
private let actions: Group<A>?
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)
}
}

0 comments on commit 0157917

Please sign in to comment.