Skip to content

Commit 461826f

Browse files
remove second background from the card
1 parent fbcc971 commit 461826f

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

Sources/ComponentsKit/Components/Card/SUCard.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public struct SUCard<Content: View>: View {
4040
self.content()
4141
.padding(self.model.contentPaddings.edgeInsets)
4242
.background(self.model.preferredBackgroundColor.color)
43-
.background(UniversalColor.background.color)
4443
.cornerRadius(self.model.cornerRadius.value)
4544
.overlay(
4645
RoundedRectangle(cornerRadius: self.model.cornerRadius.value)

Sources/ComponentsKit/Components/Card/UKCard.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ open class UKCard: UIView, UKComponent {
2525

2626
/// The primary content of the card, provided as a custom view.
2727
public let content: UIView
28-
/// The container view that holds the card's content.
29-
public let contentView = UIView()
3028

3129
// MARK: - Properties
3230

@@ -65,8 +63,7 @@ open class UKCard: UIView, UKComponent {
6563

6664
/// Sets up the card's subviews.
6765
open func setup() {
68-
self.addSubview(self.contentView)
69-
self.contentView.addSubview(self.content)
66+
self.addSubview(self.content)
7067

7168
if #available(iOS 17.0, *) {
7269
self.registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (view: Self, _: UITraitCollection) in
@@ -80,15 +77,12 @@ open class UKCard: UIView, UKComponent {
8077
/// Applies styling to the card's subviews.
8178
open func style() {
8279
Self.Style.mainView(self, model: self.model)
83-
Self.Style.contentView(self.contentView, model: self.model)
8480
}
8581

8682
// MARK: - Layout
8783

8884
/// Configures the layout.
8985
open func layout() {
90-
self.contentView.allEdges()
91-
9286
self.contentConstraints = LayoutConstraints.merged {
9387
self.content.top(self.model.contentPaddings.top)
9488
self.content.bottom(self.model.contentPaddings.bottom)
@@ -138,7 +132,7 @@ open class UKCard: UIView, UKComponent {
138132
extension UKCard {
139133
fileprivate enum Style {
140134
static func mainView(_ view: UIView, model: Model) {
141-
view.backgroundColor = UniversalColor.background.uiColor
135+
view.backgroundColor = model.preferredBackgroundColor.uiColor
142136
view.layer.cornerRadius = model.cornerRadius.value
143137
view.layer.borderWidth = model.borderWidth.value
144138
view.layer.borderColor = UniversalColor.divider.cgColor
@@ -147,10 +141,5 @@ extension UKCard {
147141
view.layer.shadowColor = model.shadow.color.cgColor
148142
view.layer.shadowOpacity = 1
149143
}
150-
151-
static func contentView(_ view: UIView, model: Model) {
152-
view.backgroundColor = model.preferredBackgroundColor.uiColor
153-
view.layer.cornerRadius = model.cornerRadius.value
154-
}
155144
}
156145
}

0 commit comments

Comments
 (0)