Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions Sources/ComponentsKit/Components/Card/SUCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,30 @@ public struct SUCard<Content: View>: View {
.cornerRadius(self.model.cornerRadius.value)
.overlay(
RoundedRectangle(cornerRadius: self.model.cornerRadius.value)
.stroke(
.strokeBorder(
self.model.borderColor.color,
lineWidth: self.model.borderWidth.value
)
)
.shadow(self.model.shadow)
.observeSize { self.contentSize = $0 }
.simultaneousGesture(DragGesture(minimumDistance: 0.0)
.onChanged { _ in
guard self.model.isTappable else { return }
self.isPressed = true
}
.onEnded { value in
guard self.model.isTappable else { return }
.contentShape(.rect)
.gesture(
DragGesture(minimumDistance: 0.0)
.onChanged { _ in
guard self.model.isTappable else { return }
self.isPressed = true
}
.onEnded { value in
guard self.model.isTappable else { return }

defer { self.isPressed = false }
defer { self.isPressed = false }

if CGRect(origin: .zero, size: self.contentSize).contains(value.location) {
self.onTap()
if CGRect(origin: .zero, size: self.contentSize)
.contains(value.location) {
self.onTap()
}
}
}
)
.scaleEffect(
self.isPressed ? self.model.animationScale.value : 1,
Expand Down