Skip to content

Commit cec3e1f

Browse files
authored
Merge pull request #18453 from wordpress-mobile/feature/18402-shared-prompt-styles
Blogging Prompts: Move shared blogging prompt styles into an extension
2 parents 7dc64ed + bd05911 commit cec3e1f

3 files changed

Lines changed: 27 additions & 15 deletions

File tree

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable {
6767
private lazy var promptLabel: UILabel = {
6868
let label = UILabel()
6969
label.translatesAutoresizingMaskIntoConstraints = false
70-
label.font = Style.promptContentFont
70+
label.font = WPStyleGuide.BloggingPrompts.promptContentFont
7171
label.textAlignment = .center
7272
label.numberOfLines = 0
7373
label.adjustsFontForContentSizeCategory = true
@@ -129,8 +129,8 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable {
129129
let label = UILabel()
130130
label.translatesAutoresizingMaskIntoConstraints = false
131131
label.text = answerInfoText
132-
label.font = Style.answerInfoLabelFont
133-
label.textColor = Style.answerInfoLabelColor
132+
label.font = WPStyleGuide.BloggingPrompts.answerInfoLabelFont
133+
label.textColor = WPStyleGuide.BloggingPrompts.answerInfoLabelColor
134134
label.textAlignment = (effectiveUserInterfaceLayoutDirection == .leftToRight ? .left : .right)
135135
label.numberOfLines = 0
136136
label.adjustsFontForContentSizeCategory = true
@@ -166,8 +166,8 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable {
166166
let button = UIButton()
167167
button.translatesAutoresizingMaskIntoConstraints = false
168168
button.setTitle(Strings.answerButtonTitle, for: .normal)
169-
button.setTitleColor(Style.buttonTitleColor, for: .normal)
170-
button.titleLabel?.font = Style.buttonTitleFont
169+
button.setTitleColor(WPStyleGuide.BloggingPrompts.buttonTitleColor, for: .normal)
170+
button.titleLabel?.font = WPStyleGuide.BloggingPrompts.buttonTitleFont
171171
button.titleLabel?.adjustsFontForContentSizeCategory = true
172172
button.titleLabel?.adjustsFontSizeToFitWidth = true
173173

@@ -178,8 +178,8 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable {
178178

179179
private lazy var answeredLabel: UILabel = {
180180
let label = UILabel()
181-
label.font = Style.buttonTitleFont
182-
label.textColor = Style.answeredLabelColor
181+
label.font = WPStyleGuide.BloggingPrompts.buttonTitleFont
182+
label.textColor = WPStyleGuide.BloggingPrompts.answeredLabelColor
183183
label.text = Strings.answeredLabelTitle
184184

185185
// The 'answered' label needs to be close to the Share button.
@@ -195,8 +195,8 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable {
195195
let button = UIButton()
196196
button.translatesAutoresizingMaskIntoConstraints = false
197197
button.setTitle(Strings.shareButtonTitle, for: .normal)
198-
button.setTitleColor(Style.buttonTitleColor, for: .normal)
199-
button.titleLabel?.font = Style.buttonTitleFont
198+
button.setTitleColor(WPStyleGuide.BloggingPrompts.buttonTitleColor, for: .normal)
199+
button.titleLabel?.font = WPStyleGuide.BloggingPrompts.buttonTitleFont
200200
button.titleLabel?.adjustsFontForContentSizeCategory = true
201201
button.titleLabel?.adjustsFontSizeToFitWidth = true
202202
button.contentHorizontalAlignment = .leading
@@ -353,12 +353,6 @@ private extension DashboardPromptsCardCell {
353353
struct Style {
354354
static let frameIconImage = UIImage(named: "icon-lightbulb-outline")?.resizedImage(Constants.cardIconSize, interpolationQuality: .default)
355355
static let avatarPlaceholderImage = UIImage(color: .quaternarySystemFill)
356-
static let promptContentFont = WPStyleGuide.serifFontForTextStyle(.headline, fontWeight: .semibold)
357-
static let answerInfoLabelFont = WPStyleGuide.fontForTextStyle(.caption1)
358-
static let answerInfoLabelColor = UIColor.primary
359-
static let buttonTitleFont = WPStyleGuide.fontForTextStyle(.subheadline)
360-
static let buttonTitleColor = UIColor.primary
361-
static let answeredLabelColor = UIColor.muriel(name: .green, .shade50)
362356
}
363357

364358
struct Constants {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// This class groups styles used by blogging prompts
2+
///
3+
extension WPStyleGuide {
4+
public struct BloggingPrompts {
5+
static let promptContentFont = WPStyleGuide.serifFontForTextStyle(.headline, fontWeight: .semibold)
6+
static let answerInfoLabelFont = WPStyleGuide.fontForTextStyle(.caption1)
7+
static let answerInfoLabelColor = UIColor.primary
8+
static let buttonTitleFont = WPStyleGuide.fontForTextStyle(.subheadline)
9+
static let buttonTitleColor = UIColor.primary
10+
static let answeredLabelColor = UIColor.muriel(name: .green, .shade50)
11+
}
12+
}

WordPress/WordPress.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,8 @@
13941394
834CE7341256D0DE0046A4A3 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 834CE7331256D0DE0046A4A3 /* CFNetwork.framework */; };
13951395
8350E49611D2C71E00A7B073 /* Media.m in Sources */ = {isa = PBXBuildFile; fileRef = 8350E49511D2C71E00A7B073 /* Media.m */; };
13961396
8355D7D911D260AA00A61362 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8355D7D811D260AA00A61362 /* CoreData.framework */; };
1397+
836498C828172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836498C728172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift */; };
1398+
836498C928172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836498C728172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift */; };
13971399
8370D10A11FA499A009D650F /* WPTableViewActivityCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8370D10911FA499A009D650F /* WPTableViewActivityCell.m */; };
13981400
839B150B2795DEE0009F5E77 /* UIView+Margins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 839B150A2795DEE0009F5E77 /* UIView+Margins.swift */; };
13991401
839B150C2795DEE0009F5E77 /* UIView+Margins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 839B150A2795DEE0009F5E77 /* UIView+Margins.swift */; };
@@ -6155,6 +6157,7 @@
61556157
8355D67D11D13EAD00A61362 /* MobileCoreServices.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
61566158
8355D7D811D260AA00A61362 /* CoreData.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
61576159
835E2402126E66E50085940B /* AssetsLibrary.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
6160+
836498C728172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WPStyleGuide+BloggingPrompts.swift"; sourceTree = "<group>"; };
61586161
8370D10811FA499A009D650F /* WPTableViewActivityCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPTableViewActivityCell.h; sourceTree = "<group>"; };
61596162
8370D10911FA499A009D650F /* WPTableViewActivityCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPTableViewActivityCell.m; sourceTree = "<group>"; };
61606163
839B150A2795DEE0009F5E77 /* UIView+Margins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Margins.swift"; sourceTree = "<group>"; };
@@ -13487,6 +13490,7 @@
1348713490
isa = PBXGroup;
1348813491
children = (
1348913492
BE1071FB1BC75E7400906AFF /* WPStyleGuide+Blog.swift */,
13493+
836498C728172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift */,
1349013494
);
1349113495
name = Style;
1349213496
sourceTree = "<group>";
@@ -18068,6 +18072,7 @@
1806818072
D853723C21952DC90076F461 /* SiteSegmentsStep.swift in Sources */,
1806918073
32E1BFDA24A66F2A007A08F0 /* ReaderInterestsCollectionViewFlowLayout.swift in Sources */,
1807018074
FEC3B81726C2915A00A395C7 /* SingleButtonTableViewCell.swift in Sources */,
18075+
836498C828172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift in Sources */,
1807118076
FF70A3221FD5840500BC270D /* PHAsset+Metadata.swift in Sources */,
1807218077
5DA5BF4418E32DCF005F11F9 /* Theme.m in Sources */,
1807318078
D8A3A5B1206A49A100992576 /* StockPhotosMediaGroup.swift in Sources */,
@@ -20627,6 +20632,7 @@
2062720632
FABB22C52602FC2C00C8785C /* ActivityStore.swift in Sources */,
2062820633
FABB22C62602FC2C00C8785C /* NSAttributedString+WPRichText.swift in Sources */,
2062920634
FABB22C72602FC2C00C8785C /* StatsTotalRow.swift in Sources */,
20635+
836498C928172C5900A2C170 /* WPStyleGuide+BloggingPrompts.swift in Sources */,
2063020636
C79C308226EA99D500E88514 /* ReferrerDetailsSpamActionCell.swift in Sources */,
2063120637
80EF672327F160720063B138 /* DashboardCustomAnnouncementCell.swift in Sources */,
2063220638
FABB22C82602FC2C00C8785C /* SiteCreationAnalyticsHelper.swift in Sources */,

0 commit comments

Comments
 (0)