-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5a7513
commit a776086
Showing
8 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
Sources/OpenTDS/Component/Button/Toolbar/ToolbarButton+Ext.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,8 @@ | ||
import SwiftUI | ||
|
||
@resultBuilder | ||
public struct TossToolbarButtonBuilder { | ||
public static func buildBlock(_ components: TossToolbarButton...) -> [TossToolbarButton] { | ||
components | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Sources/OpenTDS/Component/Button/Toolbar/ToolbarButton.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,29 @@ | ||
import SwiftUI | ||
|
||
@available(macOS 11, iOS 14, *) | ||
public struct TossToolbarButton: View { | ||
|
||
let image: Image | ||
let action: () -> () | ||
|
||
/** | ||
- Parameters: | ||
- image: Image of the Button. | ||
- action: Action when the Button pressed. | ||
*/ | ||
public init(_ image: Image, action: @escaping () -> ()) { | ||
self.image = image | ||
self.action = action | ||
} | ||
|
||
public var body: some View { | ||
Button(action: action) { | ||
image | ||
.resizable() | ||
.renderingMode(.template) | ||
.scaledToFit() | ||
.frame(width: 22, height: 22) | ||
.foregroundColor(TossColor.button) | ||
} | ||
} | ||
} |
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
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
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
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
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
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