Skip to content

Commit 2bcae21

Browse files
added border width param to card
1 parent a0861dd commit 2bcae21

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/CardPreview.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct CardPreview: View {
2323
Text("Warning Background").tag(ComponentColor.warning.background)
2424
Text("Danger Background").tag(ComponentColor.danger.background)
2525
}
26+
BorderWidthPicker(selection: self.$model.borderWidth)
2627
Picker("Content Paddings", selection: self.$model.contentPaddings) {
2728
Text("12px").tag(Paddings(padding: 12))
2829
Text("16px").tag(Paddings(padding: 16))

Sources/ComponentsKit/Components/Card/Models/CardVM.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ public struct CardVM: ComponentVM {
55
/// The background color of the card.
66
public var backgroundColor: UniversalColor?
77

8+
/// The border thickness of the card.
9+
///
10+
/// Defaults to `.medium`.
11+
public var borderWidth: BorderWidth = .medium
12+
813
/// The padding applied to the card's content area.
914
///
1015
/// Defaults to a padding value of `16` for all sides.

Sources/ComponentsKit/Components/Card/SUCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public struct SUCard<Content: View>: View {
4444
.cornerRadius(self.model.cornerRadius.value)
4545
.overlay(
4646
RoundedRectangle(cornerRadius: self.model.cornerRadius.value)
47-
.stroke(UniversalColor.divider.color, lineWidth: 1.0)
47+
.stroke(UniversalColor.divider.color, lineWidth: self.model.borderWidth.value)
4848
)
4949
.shadow(self.model.shadow)
5050
}

Sources/ComponentsKit/Components/Card/UKCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ extension UKCard {
140140
static func mainView(_ view: UIView, model: Model) {
141141
view.backgroundColor = UniversalColor.background.uiColor
142142
view.layer.cornerRadius = model.cornerRadius.value
143-
view.layer.borderWidth = 1
143+
view.layer.borderWidth = model.borderWidth.value
144144
view.layer.borderColor = UniversalColor.divider.cgColor
145145
view.layer.shadowRadius = model.shadow.radius
146146
view.layer.shadowOffset = model.shadow.offset

0 commit comments

Comments
 (0)