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

Settings Dynamic Type Fixes #626

Merged
merged 3 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Kickstarter-iOS/Views/LoadingBarButtonItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class LoadingBarButtonItemView: UIView, NibLoading {
super.bindStyles()

_ = self.titleButton
|> UIButton.lens.titleLabel.font .~ .ksr_body()
|> UIButton.lens.titleLabel.font .~ UIFont.systemFont(ofSize: 17)
|> UIButton.lens.titleColor(for: .normal) .~ .ksr_green_700
|> UIButton.lens.titleColor(for: .disabled) .~ .ksr_grey_500

Expand Down
68 changes: 37 additions & 31 deletions Library/Styles/SettingsStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,46 @@ public let settingsSectionButtonStyle =

public let settingsArrowViewStyle = UIImageView.lens.tintColor .~ .ksr_dark_grey_400

public let settingsSectionLabelStyle =
UILabel.lens.textColor .~ .ksr_soft_black
<> UILabel.lens.font .~ .ksr_subhead()
<> UILabel.lens.numberOfLines .~ 2
public let settingsSectionLabelStyle = { (label: UILabel) in
label
|> \.textColor .~ .ksr_soft_black
|> \.font .~ .ksr_subhead()
|> \.numberOfLines .~ 2
}

public let settingsTitleLabelStyle =
UILabel.lens.textColor .~ .ksr_soft_black
<> UILabel.lens.font .~ .ksr_body()
public let settingsTitleLabelStyle = { (label: UILabel) in
label
|> \.textColor .~ .ksr_soft_black
|> \.font .~ .ksr_body()
}

public let settingsDetailLabelStyle = UILabel.lens.font .~ .ksr_body()
<> UILabel.lens.numberOfLines .~ 1
<> UILabel.lens.textColor .~ .ksr_text_dark_grey_500
<> UILabel.lens.lineBreakMode .~ .byTruncatingTail
public let settingsDetailLabelStyle = { (label: UILabel) in
label
|> \.font .~ .ksr_body()
|> \.numberOfLines .~ 1
|> \.textColor .~ .ksr_text_dark_grey_500
|> \.lineBreakMode .~ .byTruncatingTail
}

public let settingsDescriptionLabelStyle = UILabel.lens.font .~ .ksr_body(size: 13)
<> UILabel.lens.numberOfLines .~ 0
<> UILabel.lens.textColor .~ .ksr_dark_grey_400
<> UILabel.lens.lineBreakMode .~ .byWordWrapping
public let settingsDescriptionLabelStyle = { (label: UILabel) in
label
|> \.font .~ .ksr_body(size: 13)
|> \.numberOfLines .~ 0
|> \.textColor .~ .ksr_dark_grey_400
|> \.lineBreakMode .~ .byWordWrapping
}

public let settingsHeaderFooterLabelBaseStyle = { (label: UILabel) in
label
|> \.font .~ .ksr_footnote()
|> \.numberOfLines .~ 0
}

public let settingsHeaderFooterLabelStyle = { (label: UILabel) in
label
|> \.backgroundColor .~ .ksr_grey_200
|> \.textColor .~ .ksr_text_dark_grey_500
}

public let settingsFormFieldStyle =
UITextField.lens.textColor .~ .ksr_text_dark_grey_500
Expand All @@ -44,10 +66,6 @@ public let settingsPasswordFormFieldAutoFillStyle = passwordFieldAutoFillStyle
public let settingsNewPasswordFormFieldAutoFillStyle = newPasswordFieldAutoFillStyle
<> settingsPasswordFormFieldStyle

public let settingsLogoutButtonStyle = borderButtonStyle
<> UIButton.lens.titleLabel.font .~ .ksr_headline(size: 15)
<> UIButton.lens.title(for: .normal) %~ { _ in Strings.profile_settings_log_out_button() }

public let settingsSeparatorStyle = UIView.lens.backgroundColor .~ .ksr_grey_500
<> UIView.lens.accessibilityElementsHidden .~ true

Expand Down Expand Up @@ -85,15 +103,3 @@ public func settingsAttributedPlaceholder(_ string: String) -> NSAttributedStrin
attributes: [NSAttributedString.Key.foregroundColor: UIColor.ksr_text_dark_grey_400]
)
}

public func settingsHeaderFooterLabelBaseStyle(_ label: UILabel) -> UILabel {
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving these 2 will probably cause some merge conflicts on the Create password branch but now that we know about it we should be able to resolve it just fine!

return label
|> \.font %~ { _ in .ksr_footnote() }
|> \.numberOfLines .~ 0
}

public func settingsHeaderFooterLabelStyle(_ label: UILabel) -> UILabel {
return label
|> \.backgroundColor .~ .ksr_grey_200
|> \.textColor .~ .ksr_text_dark_grey_500
}