-
Notifications
You must be signed in to change notification settings - Fork 2
improve button #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
improve button #83
Changes from 28 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
aedb812
SUButton new params
VislovIvan f3949d5
image fix
VislovIvan 9e5d302
improve UKButton
VislovIvan 68848a0
swiftlint fix
VislovIvan 572135f
code style fix
VislovIvan 6ac6171
shouldUpdateSize fix
VislovIvan ffd1d59
extension ImageSource and ImageLocation extracted
VislovIvan 3171a79
rename extension buttonImage
VislovIvan f9bd154
params in alphabetical order
VislovIvan f316b55
fix some logic
VislovIvan 8627341
fix uikit bug
VislovIvan 31cc411
local image size bug fix
VislovIvan f74bf7b
added contentSpacing into preview
VislovIvan f48ce2c
hide title toggle
VislovIvan 9923987
imageView contentMode
VislovIvan 74e1bf1
swiftui image size bug fix
VislovIvan 6a90b2b
preview "if" deleted
VislovIvan d97a971
deleted unused code
VislovIvan ef33dcd
fix constraints
VislovIvan 29a2e9b
intrinsicContentSize fix
VislovIvan 1af1227
uikit component code restructurization
VislovIvan 9448544
image tint color extracted into model
VislovIvan 19a71e6
func updateUIView fix
VislovIvan 97622af
image extension fix
VislovIvan 14d93ad
ImageLocation extracted
VislovIvan 8971daa
fix spacing white titleLabel is hidden
VislovIvan 5058c92
deleted if/else from swiftui component
VislovIvan 0b523e4
fix tint color to local image
VislovIvan 5cfdf75
fix preview sort
VislovIvan f3a2ee2
code fix
VislovIvan 073f1ef
fix image size updating
VislovIvan 9243dcd
some fix stackView
VislovIvan ae6e9c5
tint color fix
VislovIvan 3ff5b27
fix imageView location bug
VislovIvan 04ea424
improvements and bug fixes
mikhailChelbaev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
VislovIvan marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
Sources/ComponentsKit/Components/Button/Models/ButtonImageLocation.swift
This file contains hidden or 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,11 @@ | ||
import Foundation | ||
|
||
/// Specifies the position of the image relative to the button's title. | ||
extension ButtonVM { | ||
public enum ImageLocation { | ||
/// The image is displayed before the title. | ||
case leading | ||
/// The image is displayed after the title. | ||
case trailing | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Sources/ComponentsKit/Components/Button/Models/ButtonImageSource.swift
This file contains hidden or 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,18 @@ | ||
import Foundation | ||
|
||
/// Defines the image source options for a button. | ||
extension ButtonVM { | ||
public enum ImageSource: Hashable { | ||
/// An image loaded from a system SF Symbol. | ||
/// | ||
/// - Parameter name: The name of the SF Symbol. | ||
case sfSymbol(String) | ||
|
||
/// An image loaded from a local asset. | ||
/// | ||
/// - Parameters: | ||
/// - name: The name of the local image asset. | ||
/// - bundle: The bundle containing the image resource. Defaults to `nil` to use the main bundle. | ||
case local(String, bundle: Bundle? = nil) | ||
} | ||
} |
VislovIvan marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why you included all the
if
conditions, but I think it's better to remove them. This way, people can understand how the parameters interact with each other.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also sort the params in alphabetical order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
contentSpacing
param and a toggle to show / hide the title (similar to the one in alert / modals)