Skip to content

Commit e02b516

Browse files
authored
Merge pull request #436 from woocommerce/issue/19-notifs-nukeme-struct
Notifications: Bring text style inline with design
2 parents cee06a2 + 2254a3e commit e02b516

File tree

3 files changed

+26
-37
lines changed

3 files changed

+26
-37
lines changed

WooCommerce/Classes/Extensions/NSParagraphStyle+Woo.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ extension NSParagraphStyle {
1818
return NSMutableParagraphStyle(standardLineHeightUsingFont: UIFont.body)
1919
}
2020

21+
/// Returns a ParagraphStyle with it's minimum Line Height set to accomodate `UIFont.footnote`
22+
///
23+
static var footnote: NSParagraphStyle {
24+
return NSMutableParagraphStyle(standardLineHeightUsingFont: UIFont.footnote)
25+
}
26+
2127
/// Returns a ParagraphStyle with it's minimum Line Height set to accomodate `UIFont.body` / Centered
2228
///
2329
static var badge: NSParagraphStyle {

WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ extension StringStyles {
6060
/// Styles: Notifications List / Subject Block
6161
///
6262
static let subject: StringStyles = {
63-
let regular: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline, .foregroundColor: StyleManager.defaultTextColor]
64-
let bold: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.bold]
65-
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics]
66-
let italics: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics]
67-
let noticon: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.noticon(forStyle: .subheadline), .foregroundColor: NukeMe.subjectNoticonColor]
63+
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]
64+
let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold]
65+
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics]
66+
let italics: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics]
67+
let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.wooGreyMid]
6868

6969
return StringStyles(regular: regular, bold: bold, blockquote: blockquote, italics: italics, match: nil, noticon: noticon)
7070
}()
@@ -73,18 +73,17 @@ extension StringStyles {
7373
/// Styles: Notifications List / Snippet Block
7474
///
7575
static let snippet: StringStyles = {
76-
let regular: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.footnote, .foregroundColor: StyleManager.defaultTextColor]
77-
76+
let regular: Style = [.paragraphStyle: NSParagraphStyle.footnote, .font: UIFont.footnote, .foregroundColor: StyleManager.defaultTextColor]
7877
return StringStyles(regular: regular)
7978
}()
8079

8180

8281
/// Styles: Notification Defailts / Header Block
8382
///
8483
static let header: StringStyles = {
85-
let regular: Style = [.font: UIFont.body, .foregroundColor: NukeMe.bodyTextColor]
86-
let bold: Style = [.font: UIFont.body.bold, .foregroundColor: NukeMe.bodyTextColor]
87-
let italics: Style = [.font: UIFont.body.italics, .foregroundColor: NukeMe.headerItalicsColor]
84+
let regular: Style = [.font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]
85+
let bold: Style = [.font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor]
86+
let italics: Style = [.font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor]
8887

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

9897
return StringStyles(regular: regular, noticon: body.noticon)
9998
}()
@@ -102,30 +101,14 @@ extension StringStyles {
102101
/// Styles: Notification Defailts / Body Blocks
103102
///
104103
static let body: StringStyles = {
105-
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: NukeMe.bodyTextColor]
106-
let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: NukeMe.bodyTextColor]
107-
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: NukeMe.bodyBlockquotedColor]
108-
let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: NukeMe.bodyLinkColor]
109-
let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: NukeMe.bodyNoticonColor]
110-
let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: NukeMe.bodyTextColor]
111-
let link: Style = [.foregroundColor: NukeMe.bodyLinkColor]
104+
let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor]
105+
let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor]
106+
let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor]
107+
let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor]
108+
let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.defaultTextColor]
109+
let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor]
110+
let link: Style = [.foregroundColor: StyleManager.wooCommerceBrandColor]
112111

113112
return StringStyles(regular: regular, bold: bold, blockquote: blockquote, match: match, noticon: noticon, link: link)
114113
}()
115114
}
116-
117-
118-
// MARK: - TODO: Nuke this. Map the Colors, as required, from the StyleManager
119-
//
120-
private struct NukeMe {
121-
static let subjectNoticonColor = UIColor.black
122-
123-
static let headerItalicsColor = UIColor.gray
124-
125-
static let bodyTextColor = UIColor.black
126-
static let bodyBlockquotedColor = UIColor.black
127-
static let bodyLinkColor = UIColor.black
128-
static let bodyNoticonColor = UIColor.black
129-
130-
static let footerTextColor = UIColor.black
131-
}

WooCommerce/Classes/ViewRelated/Notifications/Cells/NoteTableViewCell.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
<nil key="textColor"/>
2828
<nil key="highlightedColor"/>
2929
</label>
30-
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="fNu-km-jyX">
31-
<rect key="frame" x="55" y="11" width="304" height="39"/>
30+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="3" translatesAutoresizingMaskIntoConstraints="NO" id="fNu-km-jyX">
31+
<rect key="frame" x="55" y="11" width="304" height="42"/>
3232
<subviews>
3333
<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">
3434
<rect key="frame" x="0.0" y="0.0" width="304" height="19.5"/>
@@ -37,7 +37,7 @@
3737
<nil key="highlightedColor"/>
3838
</label>
3939
<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">
40-
<rect key="frame" x="0.0" y="19.5" width="304" height="19.5"/>
40+
<rect key="frame" x="0.0" y="22.5" width="304" height="19.5"/>
4141
<fontDescription key="fontDescription" type="system" pointSize="16"/>
4242
<nil key="textColor"/>
4343
<nil key="highlightedColor"/>

0 commit comments

Comments
 (0)