Skip to content

Commit

Permalink
Merge pull request #2375 from CruGlobal/GT-2488-decrease-tool-tile-bu…
Browse files Browse the repository at this point in the history
…tton-padding

GT-2488 decrease tool tile button padding
  • Loading branch information
levieggertcru authored Dec 26, 2024
2 parents 979fcb9 + 2ccf577 commit fc14d7d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct ToolCardView: View {
private let navButtonWidth: CGFloat = 92
private let navButtonHeight: CGFloat = 30
private let navButtonSpacing: CGFloat = 8
private let navButtonTitleHorizontalPadding: CGFloat?
private let contentHorizontalInsets: CGFloat = 15
private let showsCategory: Bool
private let accessibility: AccessibilityStrings.Button?
Expand All @@ -31,7 +32,7 @@ struct ToolCardView: View {

@ObservedObject private var viewModel: ToolCardViewModel

init(viewModel: ToolCardViewModel, geometry: GeometryProxy, layout: ToolCardLayout, showsCategory: Bool, accessibility: AccessibilityStrings.Button?, favoriteTappedClosure: (() -> Void)?, toolDetailsTappedClosure: (() -> Void)?, openToolTappedClosure: (() -> Void)?, toolTappedClosure: (() -> Void)?) {
init(viewModel: ToolCardViewModel, geometry: GeometryProxy, layout: ToolCardLayout, showsCategory: Bool, navButtonTitleHorizontalPadding: CGFloat?, accessibility: AccessibilityStrings.Button?, favoriteTappedClosure: (() -> Void)?, toolDetailsTappedClosure: (() -> Void)?, openToolTappedClosure: (() -> Void)?, toolTappedClosure: (() -> Void)?) {

var navButtons: [ToolCardNavButtonType] = Array()

Expand All @@ -50,6 +51,7 @@ struct ToolCardView: View {
self.layout = layout
self.navButtons = navButtons
self.showsCategory = showsCategory
self.navButtonTitleHorizontalPadding = navButtonTitleHorizontalPadding
self.accessibility = accessibility
self.favoriteTappedClosure = favoriteTappedClosure
self.toolDetailsTappedClosure = toolDetailsTappedClosure
Expand Down Expand Up @@ -147,12 +149,12 @@ struct ToolCardView: View {
Spacer()
}

GTWhiteButton(title: viewModel.detailsButtonTitle, font: navButtonFont, width: navButtonWidth, height: navButtonHeight, accessibility: .toolDetails) {
GTWhiteButton(title: viewModel.detailsButtonTitle, font: navButtonFont, width: navButtonWidth, height: navButtonHeight, titleHorizontalPadding: navButtonTitleHorizontalPadding, accessibility: .toolDetails) {

toolDetailsTappedClosure?()
}

GTBlueButton(title: viewModel.openButtonTitle, font: navButtonFont, width: navButtonWidth, height: navButtonHeight, accessibility: .openTool) {
GTBlueButton(title: viewModel.openButtonTitle, font: navButtonFont, width: navButtonWidth, height: navButtonHeight, titleHorizontalPadding: navButtonTitleHorizontalPadding, accessibility: .openTool) {

openToolTappedClosure?()
}
Expand Down Expand Up @@ -224,6 +226,7 @@ struct ToolCardView_Previews: PreviewProvider {
geometry: geometry,
layout: .landscape,
showsCategory: true,
navButtonTitleHorizontalPadding: nil,
accessibility: nil,
favoriteTappedClosure: nil,
toolDetailsTappedClosure: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct ToolSpotlightView: View {
geometry: geometry,
layout: .thumbnail,
showsCategory: false,
navButtonTitleHorizontalPadding: nil,
accessibility: .spotlightTool,
favoriteTappedClosure: {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct ToolsView: View {
geometry: geometry,
layout: .landscape,
showsCategory: true,
navButtonTitleHorizontalPadding: nil,
accessibility: .tool,
favoriteTappedClosure: {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct AllYourFavoriteToolsView: View {
geometry: geometry,
layout: .landscape,
showsCategory: true,
navButtonTitleHorizontalPadding: YourFavoriteToolsView.toolCardNavButtonTitleHorizontalPadding,
accessibility: .favoriteTool,
favoriteTappedClosure: {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import SwiftUI

struct YourFavoriteToolsView: View {


static let toolCardNavButtonTitleHorizontalPadding: CGFloat = 5

private let geometry: GeometryProxy
private let contentHorizontalInsets: CGFloat
private let toolCardSpacing: CGFloat
Expand Down Expand Up @@ -47,6 +49,7 @@ struct YourFavoriteToolsView: View {
geometry: geometry,
layout: .thumbnail,
showsCategory: true,
navButtonTitleHorizontalPadding: Self.toolCardNavButtonTitleHorizontalPadding,
accessibility: .favoriteTool,
favoriteTappedClosure: {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ struct GTBlueButton: View {
let width: CGFloat
let height: CGFloat
let cornerRadius: CGFloat
let titleHorizontalPadding: CGFloat?
let titleVerticalPadding: CGFloat?
let highlightsTitleOnTap: Bool
let accessibility: AccessibilityStrings.Button?
let action: () -> Void

init(title: String, font: Font? = nil, fontSize: CGFloat? = nil, width: CGFloat, height: CGFloat, cornerRadius: CGFloat = 6, highlightsTitleOnTap: Bool = true, accessibility: AccessibilityStrings.Button? = nil, action: @escaping () -> Void) {
init(title: String, font: Font? = nil, fontSize: CGFloat? = nil, width: CGFloat, height: CGFloat, cornerRadius: CGFloat = 6, titleHorizontalPadding: CGFloat? = nil, titleVerticalPadding: CGFloat? = nil, highlightsTitleOnTap: Bool = true, accessibility: AccessibilityStrings.Button? = nil, action: @escaping () -> Void) {

self.title = title
self.width = width
self.height = height
self.cornerRadius = cornerRadius
self.titleHorizontalPadding = titleHorizontalPadding
self.titleVerticalPadding = titleVerticalPadding
self.highlightsTitleOnTap = highlightsTitleOnTap
self.accessibility = accessibility
self.action = action
Expand Down Expand Up @@ -80,7 +84,8 @@ struct GTBlueButton: View {
Text(title)
.font(font)
.foregroundColor(Color.white)
.padding()
.padding([.leading, .trailing], titleHorizontalPadding)
.padding([.top, .bottom], titleVerticalPadding)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ struct GTWhiteButton: View {
let width: CGFloat
let height: CGFloat
let cornerRadius: CGFloat
let titleHorizontalPadding: CGFloat?
let titleVerticalPadding: CGFloat?
let action: () -> Void

init(title: String, font: Font? = nil, fontSize: CGFloat? = nil, width: CGFloat, height: CGFloat, cornerRadius: CGFloat = 6, accessibility: AccessibilityStrings.Button? = nil, action: @escaping () -> Void) {
init(title: String, font: Font? = nil, fontSize: CGFloat? = nil, width: CGFloat, height: CGFloat, cornerRadius: CGFloat = 6, titleHorizontalPadding: CGFloat? = nil, titleVerticalPadding: CGFloat? = nil, accessibility: AccessibilityStrings.Button? = nil, action: @escaping () -> Void) {
self.title = title
self.width = width
self.height = height
self.cornerRadius = cornerRadius
self.titleHorizontalPadding = titleHorizontalPadding
self.titleVerticalPadding = titleVerticalPadding
self.accessibility = accessibility
self.action = action

Expand Down Expand Up @@ -58,7 +62,8 @@ struct GTWhiteButton: View {
Text(title)
.font(font)
.foregroundColor(ColorPalette.gtBlue.color)
.padding()
.padding([.leading, .trailing], titleHorizontalPadding)
.padding([.top, .bottom], titleVerticalPadding)
}
}
.frame(width: width, height: height, alignment: .center)
Expand Down

0 comments on commit fc14d7d

Please sign in to comment.