This commit is contained in:
Ali
2023-06-27 23:41:17 +03:00
parent d0ad8d4773
commit 1e56d1b8ff
23 changed files with 893 additions and 570 deletions

View File

@@ -12,15 +12,18 @@ public final class PlainButtonComponent: Component {
public let content: AnyComponent<Empty>
public let effectAlignment: EffectAlignment
public let minSize: CGSize?
public let action: () -> Void
public init(
content: AnyComponent<Empty>,
effectAlignment: EffectAlignment,
minSize: CGSize? = nil,
action: @escaping () -> Void
) {
self.content = content
self.effectAlignment = effectAlignment
self.minSize = minSize
self.action = action
}
@@ -31,6 +34,9 @@ public final class PlainButtonComponent: Component {
if lhs.effectAlignment != rhs.effectAlignment {
return false
}
if lhs.minSize != rhs.minSize {
return false
}
return true
}
@@ -122,7 +128,11 @@ public final class PlainButtonComponent: Component {
containerSize: availableSize
)
let size = contentSize
var size = contentSize
if let minSize = component.minSize {
size.width = max(size.width, minSize.width)
size.height = max(size.height, minSize.height)
}
if let contentView = self.content.view {
var contentTransition = transition