removed images that already existed

added resizer and refactored code

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-21 15:11:38 -05:00
parent 67e42b9730
commit d1006f1266
7 changed files with 22 additions and 43 deletions

View File

@ -48,7 +48,6 @@ extension Icon {
internal static let paginationRightCaret = Name(name: "pagination-right-caret")
internal static let verizonUp = Name(name: "verizon-up")
internal static let warningBold = Name(name: "warning-bold")
public static let checkmark = Name(name: "checkmark")
public static let checkmarkAlt = Name(name: "checkmark-alt")
public static let close = Name(name: "close")

View File

@ -73,8 +73,9 @@ open class PaginationButton: ButtonBase {
/// Used to make changes to the View based off a change events or from local properties.
open override func updateView() {
text = type.title
setImage(type.image, for: .normal)
tintColor = buttonTintColorConfiguration.getColor(surface)
let color = buttonTintColorConfiguration.getColor(surface)
setImage(type.image(color), for: .normal)
tintColor = color
super.updateView()
}
}
@ -94,13 +95,16 @@ extension PaginationButton {
"Previous"
}
}
private var imageSize: CGSize { Icon.Size.xsmall.dimensions }
///Image for the configuration type
var image: UIImage? {
func image(_ color: UIColor) -> UIImage? {
switch self {
case .previous:
BundleManager.shared.image(for: "pagination-arrow-left")?.withRenderingMode(.alwaysTemplate)
UIImage.image(for: .paginationLeftArrow, color: color, renderingMode: .alwaysTemplate)?.resized(to: imageSize)
case .next:
BundleManager.shared.image(for: "pagination-arrow-right")?.withRenderingMode(.alwaysTemplate)
UIImage.image(for: .paginationRightArrow, color: color, renderingMode: .alwaysTemplate)?.resized(to: imageSize)
}
}
}

View File

@ -23,4 +23,17 @@ extension UIImage {
return image.withTintColor(color, renderingMode: renderingMode)
}
/// Resizes image to a specific Size
/// - Parameter size: Size to resize
/// - Returns: Image that is resized
public func resized(to size: CGSize) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
defer { UIGraphicsEndImageContext() }
draw(in: .init(origin: .zero, size: size))
return UIGraphicsGetImageFromCurrentImageContext()
}
}

View File

@ -1,12 +0,0 @@
{
"images" : [
{
"filename" : "pagination-arrow-left.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,10 +0,0 @@
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_36674_119239)">
<path d="M11.0098 6.50388H2.67786L6.63428 10.4248L5.93018 11.1357L0.750489 6.002L5.92725 0.870117L6.63135 1.58012L2.67371 5.50388H11.0098L11.0098 6.50388Z" fill="black"/>
</g>
<defs>
<clipPath id="clip0_36674_119239">
<rect width="12" height="12" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 426 B

View File

@ -1,12 +0,0 @@
{
"images" : [
{
"filename" : "pagination-arrow-right.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,3 +0,0 @@
<svg width="11" height="12" viewBox="0 0 11 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.2596 6.00176L5.07986 11.1355L4.37576 10.4246L8.33256 6.50419H0.000762939V5.50419H8.33776L4.37918 1.57987L5.08328 0.869873L10.2596 6.00176Z" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 271 B