Skip to content

Commit

Permalink
nit-picking (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanzhong authored Nov 18, 2024
1 parent 1437808 commit 81becf2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions LunarBarMac/Sources/Views/DateDetailsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct DateDetailsView: View {
Divider()
}

ForEach(0..<events.count, id: \.self) { index in
ForEach(0..<min(events.count, Constants.maximumRows), id: \.self) { index in
let event = events[index]
HStack {
Circle()
Expand All @@ -38,7 +38,7 @@ struct DateDetailsView: View {
.font(.system(size: Constants.fontSize))
.frame(maxWidth: .infinity, alignment: .leading)
.strikethrough(event.isCompletedItem)
Spacer(minLength: Constants.smallPadding * 3)
Spacer(minLength: Constants.largePadding)
Text(event.labelOfDates)
.font(.system(size: Constants.fontSize))
.frame(alignment: .trailing)
Expand All @@ -51,6 +51,13 @@ struct DateDetailsView: View {
}
}
.padding(.horizontal, Constants.smallPadding)

// Indicator for more events
if events.count > Constants.maximumRows {
Image(systemName: "ellipsis")
.foregroundStyle(.secondary)
.padding(.vertical, 2)
}
}
}

Expand Down Expand Up @@ -140,7 +147,9 @@ private enum Constants {
static let dotSize: Double = 6
static let rowHeight: Double = 28
static let smallPadding: Double = 8
static let largePadding: Double = 24
static let maximumWidth: Double = 280
static let maximumRows: Int = 12
static let dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm"
Expand Down

0 comments on commit 81becf2

Please sign in to comment.