Skip to content

Commit fd77126

Browse files
committed
padding fix
1 parent 4504026 commit fd77126

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Sources/ComponentsKit/ProgressBar/Models/ProgressBarVM.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public struct ProgressBarVM: ComponentVM {
3737
/// The angle of the stripes in the `.striped` progress bar style..
3838
public var stripeAngle: Angle = .degrees(135)
3939

40+
/// The padding applied to the modal's content area.
41+
///
42+
/// Defaults to a padding value of `3` for all sides.
43+
public var contentPaddings: Paddings = .init(padding: 3)
44+
4045
/// Initializes a new instance of `ProgressBarVM` with default values.
4146
public init() {}
4247
}

Sources/ComponentsKit/ProgressBar/SUProgressBar.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public struct SUProgressBar: View {
4949
RoundedRectangle(cornerRadius: self.model.computedCornerRadius)
5050
.foregroundStyle((self.model.color.contrast ?? .foreground).color)
5151
.frame(width: (geometry.size.width - 6) * self.fraction, height: self.model.barHeight - 6)
52-
.padding(3)
53-
.scaleEffect(self.fraction == 0 ? 0 : 1, anchor: .leading)
52+
.padding(.vertical, self.model.contentPaddings.top)
53+
.padding(.horizontal, self.model.contentPaddings.trailing)
5454
}
5555
.animation(.spring, value: self.fraction)
5656

@@ -63,7 +63,8 @@ public struct SUProgressBar: View {
6363
RoundedRectangle(cornerRadius: self.model.computedCornerRadius)
6464
.foregroundStyle(self.model.color.contrast.color)
6565
.frame(width: (geometry.size.width - 6) * self.fraction, height: self.model.barHeight - 6)
66-
.padding(3)
66+
.padding(.vertical, self.model.contentPaddings.top)
67+
.padding(.horizontal, self.model.contentPaddings.trailing)
6768

6869
StripesShape(model: self.model)
6970
.foregroundStyle(self.model.color.main.color)

0 commit comments

Comments
 (0)