Skip to content

Commit

Permalink
Merge pull request #16 from wordpress-mobile/feature/subheadline-butt…
Browse files Browse the repository at this point in the history
…on-appearance

Configure subheadline button title color
  • Loading branch information
mindgraffiti authored Jul 17, 2018
2 parents b834110 + 3aecb1c commit 5b6cb16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ public struct WordPressAuthenticatorStyle {

public let disabledTitleColor: UIColor

/// Style: Subheadline
///
public let subheadlineColor: UIColor

/// Designated initializer
///
public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor) {
public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor, subheadlineColor: UIColor) {
self.primaryNormalBackgroundColor = primaryNormalBackgroundColor
self.primaryNormalBorderColor = primaryNormalBorderColor
self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor
Expand All @@ -53,6 +57,7 @@ public struct WordPressAuthenticatorStyle {
self.primaryTitleColor = primaryTitleColor
self.secondaryTitleColor = secondaryTitleColor
self.disabledTitleColor = disabledTitleColor
self.subheadlineColor = subheadlineColor
}
}

Expand All @@ -70,6 +75,7 @@ public extension WordPressAuthenticatorStyle {
disabledBorderColor: WPStyleGuide.greyLighten30(),
primaryTitleColor: UIColor.white,
secondaryTitleColor: WPStyleGuide.darkGrey(),
disabledTitleColor: WPStyleGuide.greyLighten30())
disabledTitleColor: WPStyleGuide.greyLighten30(),
subheadlineColor: WPStyleGuide.wordPressBlue())
}
}
2 changes: 2 additions & 0 deletions WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ final class SubheadlineButton: UIButton {
super.traitCollectionDidChange(previousTraitCollection)
if previousTraitCollection?.preferredContentSizeCategory != traitCollection.preferredContentSizeCategory {
titleLabel?.font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
setTitleColor(WordPressAuthenticator.shared.style.subheadlineColor, for: .normal)
}
}
}
Expand Down Expand Up @@ -162,6 +163,7 @@ extension WPStyleGuide {
button.titleLabel?.font = font
button.titleLabel?.numberOfLines = 0
button.titleLabel?.lineBreakMode = .byWordWrapping
button.setTitleColor(WordPressAuthenticator.shared.style.subheadlineColor, for: .normal)

// These constraints work around some issues with multiline buttons and
// vertical layout. Without them the button's height may not account
Expand Down

0 comments on commit 5b6cb16

Please sign in to comment.