Skip to content
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
6 changes: 6 additions & 0 deletions WooCommerce/Classes/Extensions/NSParagraphStyle+Woo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ extension NSParagraphStyle {
return NSMutableParagraphStyle(standardLineHeightUsingFont: UIFont.body)
}

/// Returns a ParagraphStyle with it's minimum Line Height set to accomodate `UIFont.footnote`
///
static var footnote: NSParagraphStyle {
return NSMutableParagraphStyle(standardLineHeightUsingFont: UIFont.footnote)
}

/// Returns a ParagraphStyle with it's minimum Line Height set to accomodate `UIFont.body` / Centered
///
static var badge: NSParagraphStyle {
Expand Down
51 changes: 17 additions & 34 deletions WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ extension StringStyles {
/// Styles: Notifications List / Subject Block
///
static let subject: StringStyles = {
let regular: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline, .foregroundColor: StyleManager.defaultTextColor]
let bold: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.bold]
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics]
let italics: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics]
let noticon: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.noticon(forStyle: .subheadline), .foregroundColor: NukeMe.subjectNoticonColor]
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]
let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold]
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics]
let italics: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics]
let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.wooGreyMid]

return StringStyles(regular: regular, bold: bold, blockquote: blockquote, italics: italics, match: nil, noticon: noticon)
}()
Expand All @@ -73,18 +73,17 @@ extension StringStyles {
/// Styles: Notifications List / Snippet Block
///
static let snippet: StringStyles = {
let regular: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.footnote, .foregroundColor: StyleManager.defaultTextColor]

let regular: Style = [.paragraphStyle: NSParagraphStyle.footnote, .font: UIFont.footnote, .foregroundColor: StyleManager.defaultTextColor]
return StringStyles(regular: regular)
}()


/// Styles: Notification Defailts / Header Block
///
static let header: StringStyles = {
let regular: Style = [.font: UIFont.body, .foregroundColor: NukeMe.bodyTextColor]
let bold: Style = [.font: UIFont.body.bold, .foregroundColor: NukeMe.bodyTextColor]
let italics: Style = [.font: UIFont.body.italics, .foregroundColor: NukeMe.headerItalicsColor]
let regular: Style = [.font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]
let bold: Style = [.font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor]
let italics: Style = [.font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor]

return StringStyles(regular: regular, bold: bold, italics: italics)
}()
Expand All @@ -93,7 +92,7 @@ extension StringStyles {
/// Styles: Notification Defailts / Footer Block
///
static let footer: StringStyles = {
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: NukeMe.footerTextColor]
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]

return StringStyles(regular: regular, noticon: body.noticon)
}()
Expand All @@ -102,30 +101,14 @@ extension StringStyles {
/// Styles: Notification Defailts / Body Blocks
///
static let body: StringStyles = {
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: NukeMe.bodyTextColor]
let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: NukeMe.bodyTextColor]
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: NukeMe.bodyBlockquotedColor]
let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: NukeMe.bodyLinkColor]
let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: NukeMe.bodyNoticonColor]
let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: NukeMe.bodyTextColor]
let link: Style = [.foregroundColor: NukeMe.bodyLinkColor]
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]
let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor]
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor]
let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor]
let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.defaultTextColor]
let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor]
let link: Style = [.foregroundColor: StyleManager.wooCommerceBrandColor]

return StringStyles(regular: regular, bold: bold, blockquote: blockquote, match: match, noticon: noticon, link: link)
}()
}


// MARK: - TODO: Nuke this. Map the Colors, as required, from the StyleManager
//
private struct NukeMe {
static let subjectNoticonColor = UIColor.black

static let headerItalicsColor = UIColor.gray

static let bodyTextColor = UIColor.black
static let bodyBlockquotedColor = UIColor.black
static let bodyLinkColor = UIColor.black
static let bodyNoticonColor = UIColor.black

static let footerTextColor = UIColor.black
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="fNu-km-jyX">
<rect key="frame" x="55" y="11" width="304" height="39"/>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="3" translatesAutoresizingMaskIntoConstraints="NO" id="fNu-km-jyX">
<rect key="frame" x="55" y="11" width="304" height="42"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Subject" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ow4-CR-HAI" userLabel="Subject Label">
<rect key="frame" x="0.0" y="0.0" width="304" height="19.5"/>
Expand All @@ -37,7 +37,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="Snippet" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JQs-0C-rb6" userLabel="Snippet Label">
<rect key="frame" x="0.0" y="19.5" width="304" height="19.5"/>
<rect key="frame" x="0.0" y="22.5" width="304" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down