Skip to content

Commit 821c784

Browse files
authored
Update Reader iconography (#24132)
* Update icons in Reader main menu * Update icon in comments * Slightly inrease title font for posts in Reader * Update release notes * Tweak indicators
1 parent 86a00f9 commit 821c784

File tree

49 files changed

+235
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+235
-134
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import SwiftUI
2+
3+
/// A simple view for scaling the given icon to the target size.
4+
public struct ScaledImage: View {
5+
private let imageName: String
6+
@ScaledMetric(relativeTo: .body) var height = 17
7+
8+
/// - warning: The image should have `Preserve Vector Data` option enabled
9+
/// for the best results.
10+
public init(_ name: String, height: CGFloat, relativeTo textSyle: Font.TextStyle = .body) {
11+
self.imageName = name
12+
self._height = ScaledMetric(wrappedValue: height, relativeTo: textSyle)
13+
}
14+
15+
public var body: some View {
16+
Image(imageName)
17+
.resizable()
18+
.aspectRatio(contentMode: .fit)
19+
.frame(height: height)
20+
}
21+
}

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [*] Add depth indicators for comment threads to make them easier to follow [#24117]
66
* [*] Enable dismissing the virtual keyboard in the experimental editor [#23988]
77
* [*] Remove Submit Feedback form from the Me menu [#24020]
8+
* [*] Update iconography in Reader to match WordPress design system [#24132]
89
* [*] Fix unselectable group blocks in the experimental editor [https://github.com/wordpress-mobile/GutenbergKit/pull/68]
910
* [*] Prevent a intermittent crash when opening the experimental editor's "more" menu [#24065]
1011
* [*] Fix an issue with follow/unfollow buttons not working for tags [#24130]

WordPress/Classes/ViewRelated/Comments/Views/Detail/CommentContentTableViewCell.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,15 @@ private extension CommentContentTableViewCell {
324324
accessoryButton?.setImage(accessoryButtonImage, for: .normal)
325325
accessoryButton?.addTarget(self, action: #selector(accessoryButtonTapped), for: .touchUpInside)
326326

327-
replyButton.configuration = makeReactionButtonConfiguration(systemImage: "arrowshape.turn.up.left")
327+
replyButton.configuration = makeReactionButtonConfiguration(image: UIImage(named: "icon-reader-comment-reply"))
328328
replyButton.configuration?.contentInsets.leading = 0
329329
replyButton.tintColor = .secondaryLabel
330330
replyButton.setTitle(.reply, for: .normal)
331331
replyButton.addTarget(self, action: #selector(replyButtonTapped), for: .touchUpInside)
332332
replyButton.maximumContentSizeCategory = .accessibilityMedium
333333
replyButton.accessibilityIdentifier = .replyButtonAccessibilityId
334334

335-
likeButton.configuration = makeReactionButtonConfiguration(systemImage: "star")
335+
likeButton.configuration = makeReactionButtonConfiguration(image: WPStyleGuide.ReaderDetail.likeToolbarIcon)
336336
likeButton.tintColor = .secondaryLabel
337337

338338
likeButton.addTarget(self, action: #selector(likeButtonTapped), for: .touchUpInside)
@@ -342,18 +342,18 @@ private extension CommentContentTableViewCell {
342342
applyStyles()
343343
}
344344

345-
private func makeReactionButtonConfiguration(systemImage: String) -> UIButton.Configuration {
345+
private func makeReactionButtonConfiguration(image: UIImage? = nil) -> UIButton.Configuration {
346346
var configuration = UIButton.Configuration.plain()
347347
let font = UIFont.preferredFont(forTextStyle: .footnote)
348-
configuration.image = UIImage(systemName: systemImage)
348+
configuration.image = image
349349
configuration.imagePlacement = .leading
350350
configuration.imagePadding = 6
351351
configuration.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer {
352352
var attributes = $0
353-
attributes.font = font
353+
attributes.font = font.withWeight(.medium)
354354
return attributes
355355
}
356-
configuration.contentInsets = .init(top: 10, leading: 8, bottom: 12, trailing: 8)
356+
configuration.contentInsets = .init(top: 8, leading: 8, bottom: 8, trailing: 8)
357357
configuration.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(font: font)
358358
return configuration
359359
}
@@ -388,7 +388,7 @@ private extension CommentContentTableViewCell {
388388
func updateLikeButton(isLiked: Bool, likeCount: Int) {
389389
likeButton.tintColor = isLiked ? UIAppColor.primary : .secondaryLabel
390390
if var configuration = likeButton.configuration {
391-
configuration.image = UIImage(systemName: isLiked ? "star.fill" : "star")
391+
configuration.image = isLiked ? WPStyleGuide.ReaderDetail.likeSelectedToolbarIcon : WPStyleGuide.ReaderDetail.likeToolbarIcon
392392
configuration.title = likeCount > 0 ? "\(likeCount)" : String.noLikes
393393
likeButton.accessibilityLabel = {
394394
switch likeCount {

WordPress/Classes/ViewRelated/Comments/Views/Detail/CommentContentTableViewCell.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</constraints>
2929
</view>
3030
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="hcN-S7-sLG" userLabel="Container Stack View">
31-
<rect key="frame" x="16" y="0.0" width="288" height="336"/>
31+
<rect key="frame" x="16" y="4" width="288" height="336"/>
3232
<subviews>
3333
<view contentMode="scaleToFill" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="f2E-yC-BJS" userLabel="Header View">
3434
<rect key="frame" x="0.0" y="0.0" width="288" height="53"/>
@@ -155,10 +155,10 @@
155155
</subviews>
156156
<constraints>
157157
<constraint firstAttribute="trailing" secondItem="hcN-S7-sLG" secondAttribute="trailing" constant="16" id="2zy-oR-X5O"/>
158-
<constraint firstAttribute="bottom" secondItem="hcN-S7-sLG" secondAttribute="bottom" priority="999" constant="4" id="FxL-ee-fbZ"/>
158+
<constraint firstAttribute="bottom" secondItem="hcN-S7-sLG" secondAttribute="bottom" priority="999" id="FxL-ee-fbZ"/>
159159
<constraint firstItem="mNJ-fg-sKO" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="II8-F0-CBs"/>
160160
<constraint firstItem="mNJ-fg-sKO" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="eId-Od-5wj"/>
161-
<constraint firstItem="hcN-S7-sLG" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="esQ-oB-yxJ"/>
161+
<constraint firstItem="hcN-S7-sLG" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="4" id="esQ-oB-yxJ"/>
162162
<constraint firstAttribute="bottom" secondItem="mNJ-fg-sKO" secondAttribute="bottom" id="izD-cW-YFx"/>
163163
<constraint firstItem="hcN-S7-sLG" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="uFL-PF-ffo"/>
164164
</constraints>

WordPress/Classes/ViewRelated/Reader/Cards/ReaderPostCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private final class ReaderPostCellView: UIView {
133133
setupTimeLabel(timeLabel)
134134
timeLabel.setContentCompressionResistancePriority(.init(800), for: .horizontal)
135135

136-
titleLabel.font = .preferredFont(forTextStyle: .headline)
136+
titleLabel.font = UIFontMetrics.default.scaledFont(for: UIFont.systemFont(ofSize: 18, weight: .semibold))
137137
titleLabel.adjustsFontForContentSizeCategory = true
138138
titleLabel.maximumContentSizeCategory = .accessibilityExtraLarge
139139

WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarListsSection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct ReaderSidebarListCell: View {
2424
Text(list.title)
2525
.lineLimit(1)
2626
} icon: {
27-
Image(systemName: "list.star")
27+
ReaderSidebarImage(name: "reader-menu-list")
2828
.foregroundStyle(.secondary)
2929
}
3030
.tag(ReaderSidebarItem.list(TaggedManagedObjectID(list)))

WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarOrganizationSection.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ struct ReaderSidebarOrganizationSection: View {
1313
Text(list.title)
1414
.lineLimit(1)
1515
} icon: {
16-
// TODO: update icon
17-
Image(systemName: "list.star")
16+
let imageName = {
17+
switch list.slug {
18+
case "a8c": "reader-menu-a8c"
19+
case "p2": "reader-menu-pin"
20+
default: "reader-menu-list"
21+
}
22+
}()
23+
ScaledImage(imageName, height: 24, relativeTo: .body)
1824
.foregroundStyle(.secondary)
1925
}
2026
.tag(ReaderSidebarItem.organization(TaggedManagedObjectID(list)))

WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarTagsSection.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct ReaderSidebarTagsSection: View {
2020
Text(tag.title)
2121
.lineLimit(1)
2222
} icon: {
23-
Image(systemName: "tag")
23+
ReaderSidebarImage(name: "reader-menu-tag")
2424
.foregroundStyle(.secondary)
2525
}
2626
.tag(ReaderSidebarItem.tag(TaggedManagedObjectID(tag)))
@@ -42,14 +42,22 @@ struct ReaderSidebarTagsSection: View {
4242
Button {
4343
viewModel.navigate(.addTag)
4444
} label: {
45-
Label(Strings.addTag, systemImage: "plus.circle")
45+
Label {
46+
Text(Strings.addTag)
47+
} icon: {
48+
ReaderSidebarImage(name: "reader-menu-plus")
49+
}
4650
}
4751
.listItemTint(AppColor.primary)
4852

4953
Button {
5054
viewModel.navigate(.discoverTags)
5155
} label: {
52-
Label(Strings.discoverTags, systemImage: "sparkle.magnifyingglass")
56+
Label {
57+
Text(Strings.discoverTags)
58+
} icon: {
59+
ReaderSidebarImage(name: "reader-menu-explorer")
60+
}
5361
}
5462
.listItemTint(AppColor.primary)
5563
}

WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewController.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private struct ReaderSidebarView: View {
120120
Section {
121121
let screens = ReaderStaticScreen.allCases
122122
ForEach(ReaderStaticScreen.allCases) {
123-
makePrimaryNavigationItem($0.localizedTitle, systemImage: $0.systemImage)
123+
makePrimaryNavigationItem($0.localizedTitle, imageName: $0.imageName)
124124
.tag(ReaderSidebarItem.main($0))
125125
.listRowSeparator((viewModel.isCompact && $0 != screens.last) ? .visible : .hidden, edges: .bottom)
126126
.accessibilityIdentifier($0.accessibilityIdentifier)
@@ -140,7 +140,11 @@ private struct ReaderSidebarView: View {
140140
}
141141
}
142142
makeSection(Strings.subscriptions, isExpanded: $isSectionSubscriptionsExpanded) {
143-
Label(Strings.subscriptions, systemImage: "checkmark.rectangle.stack")
143+
Label {
144+
Text(Strings.subscriptions)
145+
} icon: {
146+
ReaderSidebarImage(name: "reader-menu-subscriptions")
147+
}
144148
.tag(ReaderSidebarItem.allSubscriptions)
145149
.listItemTint(AppColor.primary)
146150
.withDisabledSelection(isEditing)
@@ -156,13 +160,13 @@ private struct ReaderSidebarView: View {
156160
}
157161
}
158162

159-
private func makePrimaryNavigationItem(_ title: String, systemImage: String) -> some View {
163+
private func makePrimaryNavigationItem(_ title: String, imageName: String) -> some View {
160164
HStack {
161165
Label {
162166
Text(title)
163167
.font(.headline).fontWeight(.medium)
164168
} icon: {
165-
Image(systemName: systemImage)
169+
ScaledImage(imageName, height: 24, relativeTo: .headline)
166170
}
167171
.lineLimit(1)
168172
if viewModel.isCompact {
@@ -234,6 +238,14 @@ private struct ReaderSidebarSection<Content: View>: View {
234238
}
235239
}
236240

241+
struct ReaderSidebarImage: View {
242+
let name: String
243+
244+
var body: some View {
245+
ScaledImage(name, height: 24, relativeTo: .body)
246+
}
247+
}
248+
237249
private extension View {
238250
@ViewBuilder func withDisabledSelection(_ isDisabled: Bool) -> some View {
239251
if #available(iOS 17, *) {

WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewModel.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ enum ReaderStaticScreen: String, CaseIterable, Identifiable, Hashable {
9797
}
9898
}
9999

100-
var systemImage: String {
100+
var imageName: String {
101101
switch self {
102-
case .recent: "checkmark.circle"
103-
case .discover: "safari"
104-
case .saved: "bookmark"
105-
case .likes: "star"
106-
case .search: "magnifyingglass"
102+
case .recent: "reader-menu-home"
103+
case .discover: "reader-menu-explorer"
104+
case .saved: "reader-menu-bookmark"
105+
case .likes: "reader-menu-star"
106+
case .search: "reader-menu-search"
107107
}
108108
}
109109

0 commit comments

Comments
 (0)