Skip to content

Commit a90bb02

Browse files
committed
Replace read-time with author
1 parent 981e498 commit a90bb02

12 files changed

Lines changed: 28 additions & 17 deletions

File tree

-2.05 KB
Binary file not shown.
-4.37 KB
Binary file not shown.
-7.11 KB
Binary file not shown.

BoxFeed/Assets.xcassets/clock.imageset/Contents.json renamed to BoxFeed/Assets.xcassets/pen.imageset/Contents.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"images" : [
33
{
4-
"filename" : "clock-outline 2.png",
4+
"filename" : "edit-2-outline 1.png",
55
"idiom" : "universal",
66
"scale" : "1x"
77
},
88
{
9-
"filename" : "clock-outline 2@2x.png",
9+
"filename" : "edit-2-outline 1@2x.png",
1010
"idiom" : "universal",
1111
"scale" : "2x"
1212
},
1313
{
14-
"filename" : "clock-outline 2@3x.png",
14+
"filename" : "edit-2-outline 1@3x.png",
1515
"idiom" : "universal",
1616
"scale" : "3x"
1717
}
1.24 KB
Loading
2.65 KB
Loading
4.21 KB
Loading

BoxFeed/Library/CustomViews/NewsModelView.swift

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,40 @@ struct NewsModelView: View {
2828
.foregroundColor(.text_primary)
2929
.modifier(FontModifier(.bold, size: 14))
3030
HStack(alignment: .center, spacing: 12) {
31-
newsData(image: Image.calender, text: model.publishedDate ?? "")
32-
if let time = model.readTime {
33-
newsData(image: Image.clock, text: "\(time < 10 ? "0" : "")\(time)m")
31+
if let date = model.publishedDate {
32+
publishedDate(date)
33+
}
34+
if let author = model.author {
35+
authorView(author)
3436
}
3537
}
3638
}
37-
38-
Spacer()
3939
}
4040
}
4141

42-
private func newsData(image: Image, text: String) -> some View {
42+
private func publishedDate(_ date: String) -> some View {
43+
HStack(alignment: .center, spacing: 8) {
44+
Image.calender.resizable()
45+
.renderingMode(.template)
46+
.foregroundColor(.text_primary)
47+
.frame(width: 17, height: 17)
48+
.offset(x: 0, y: -1)
49+
Text(date).lineLimit(1)
50+
.foregroundColor(.text_primary)
51+
.modifier(FontModifier(.bold, size: 12))
52+
.layoutPriority(1)
53+
.fixedSize(horizontal: true, vertical: false)
54+
}
55+
}
56+
57+
private func authorView(_ author: String) -> some View {
4358
HStack(alignment: .center, spacing: 8) {
44-
image.resizable()
59+
Image.pen.resizable()
4560
.renderingMode(.template)
4661
.foregroundColor(.text_primary)
47-
.frame(width: 16, height: 16)
62+
.frame(width: 17, height: 17)
4863
.offset(x: 0, y: -1)
49-
Text(text).lineLimit(1)
64+
Text(author).lineLimit(1)
5065
.foregroundColor(.text_primary)
5166
.modifier(FontModifier(.bold, size: 12))
5267
}

BoxFeed/Library/Helpers/ImageExtension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extension Image {
1313
static let article = Image("article")
1414
static let x = Image("x")
1515
static let calender = Image("calender")
16-
static let clock = Image("clock")
16+
static let pen = Image("pen")
1717
static let bookmark = Image("bookmark")
1818
static let bookmark_filled = Image("bookmark-filled")
1919
}

0 commit comments

Comments
 (0)