Skip to content
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

[Brand Updates] Remove underline from links in the app #14938

Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private extension ULAccountMismatchViewController {
func configureTermsLabel() {
let linkAttributes: [NSAttributedString.Key: Any] = [
NSAttributedString.Key.foregroundColor: UIColor.accent,
NSAttributedString.Key.underlineColor: UIColor.accent,
NSAttributedString.Key.underlineColor: UIColor.clear,
NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue
]
termsLabel.linkTextAttributes = linkAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private extension ULErrorViewController {
func configureTermsLabel() {
let linkAttributes: [NSAttributedString.Key: Any] = [
NSAttributedString.Key.foregroundColor: UIColor.accent,
NSAttributedString.Key.underlineColor: UIColor.accent,
NSAttributedString.Key.underlineColor: UIColor.clear,
NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue
]
termsLabel.linkTextAttributes = linkAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct POSProgressViewStyle: ProgressViewStyle {
lineWidth: lineWidth,
lineCap: .butt,
circleColor: Color(.wooCommercePurple(.shade10)),
fillColor: Color.accent
fillColor: Color.posAccent
))
}
}
8 changes: 4 additions & 4 deletions WooCommerce/Classes/POS/Utils/Color+WooCommercePOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI

extension Color {

static var accent: Color {
static var posAccent: Color {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix that I mentioned above, in a recent PR, I introduced this new property, and it resulted in an issue with the subtle button style that we use for "Write with AI" button:

My understanding of the issue: given that now we had UIColor.accent and Color.accent both in the app, the UIKitAttributes.foregroundColor started using the Color one, and ignore it at runtime, so to avoid any other similar issues, I'm renaming this property to make it clearer it's only for POS screens.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation!

return Color(
UIColor(
light: .withColorStudio(.wooCommercePurple, shade: .shade40),
Expand Down Expand Up @@ -107,11 +107,11 @@ extension Color {

// MARK: - Buttons

static var posPrimaryButtonBackground: Color = .accent
static var posPrimaryButtonBackground: Color = .posAccent

static var posSecondaryButtonForeground: Color = .accent
static var posSecondaryButtonForeground: Color = .posAccent

static var posTextButtonForeground: Color = .accent
static var posTextButtonForeground: Color = .posAccent

static var posTextButtonForegroundPressed: Color {
return Color(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private struct PermanentNoticeContentView: View {
.bodyStyle()
Button(action: notice.callToActionHandler, label: {
Text(notice.callToActionTitle)
.underline()
.font(.body)
.foregroundColor(Color(.accent))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct AccountCreationForm: View {
.renderedIf(viewModel.currentField == .password)

// Terms of Service link.
AttributedText(tosAttributedText, enablesLinkUnderline: true)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should remove the enableLinkUnderline completely now or not, WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am OK with keeping it inside AttributedText as a feature. IMO, cleaning up AttributedText sounds like it is out of scope for this project.

AttributedText(tosAttributedText)
.attributedTextLinkColor(Color(.secondaryLabel))
.environment(\.customOpenURL) { url in
tosURL = url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ final class StoreOnboardingLaunchStoreViewModel: ObservableObject {
]
)
let upgradeLink = NSAttributedString(string: linkContent, attributes: [.font: font,
.foregroundColor: linkColor,
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: UIColor.textLink])
.foregroundColor: linkColor,
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: UIColor.clear])
attributedString.replaceFirstOccurrence(of: linkContent, with: upgradeLink)
return attributedString
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private extension PrivacySettingsViewController {
textView.delegate = self

var linkTextAttributes = textView.linkTextAttributes ?? [:]
linkTextAttributes[.underlineColor] = UIColor.primary
linkTextAttributes[.underlineColor] = UIColor.clear
linkTextAttributes[.foregroundColor] = UIColor.primary
textView.linkTextAttributes = linkTextAttributes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct AddProductWithAIActionSheet: View {
.subheadlineStyle()
AdaptiveStack(horizontalAlignment: .leading) {
Text(Localization.CreateProductWithAI.legalText)
Text(.init(Localization.CreateProductWithAI.learnMore)).underline()
Text(.init(Localization.CreateProductWithAI.learnMore))
}
.environment(\.openURL, OpenURLAction { url in
legalURL = url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private extension ProductFormTableViewDataSource {
attributes: [.font: font,
.foregroundColor: linkColor,
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: linkColor,
.underlineColor: UIColor.clear,
.link: Constants.legalURL])
attributedString.replaceFirstOccurrence(of: linkContent, with: legalLink)
return attributedString
Expand Down
Loading