Skip to content

Commit 6a81009

Browse files
Merge pull request #54 from componentskit/fix/countdown-layout
Fix breaking layout in Countdown
2 parents badde63 + 869787f commit 6a81009

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Sources/ComponentsKit/Components/Countdown/Helpers/CountdownWidthCalculator.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ struct CountdownWidthCalculator {
99
for attributedText: NSAttributedString,
1010
model: CountdownVM
1111
) -> CGFloat {
12-
self.style(label, with: model)
12+
self.style(self.label, with: model)
1313
self.label.attributedText = attributedText
1414

1515
let estimatedSize = self.label.sizeThatFits(UIView.layoutFittingExpandedSize)
1616

17-
return estimatedSize.width
17+
return estimatedSize.width + 2
1818
}
1919

2020
private static func style(_ label: UILabel, with model: CountdownVM) {
21+
label.textAlignment = .center
2122
label.numberOfLines = 0
2223
}
2324
}

Sources/ComponentsKit/Components/Countdown/SUCountdown.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public struct SUCountdown: View {
2828
switch (self.model.style, self.model.unitsStyle) {
2929
case (.plain, .bottom):
3030
self.styledTime(value: self.manager.days, unit: .days)
31-
colonView
31+
self.colonView
3232
self.styledTime(value: self.manager.hours, unit: .hours)
33-
colonView
33+
self.colonView
3434
self.styledTime(value: self.manager.minutes, unit: .minutes)
35-
colonView
35+
self.colonView
3636
self.styledTime(value: self.manager.seconds, unit: .seconds)
3737

3838
case (.plain, .hidden), (.plain, .trailing):

0 commit comments

Comments
 (0)