-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from oversizedev/develop
Fix avatar image scale
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
Sources/OversizeUI/Controls/KeyboardToolbar/KeyboardToolbar.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |