51 lines
1.2 KiB
Swift
51 lines
1.2 KiB
Swift
//
|
||
// SwiftUIView.swift
|
||
// UIKitComponents
|
||
//
|
||
// Created by User on 26.05.2025.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
public struct CartButtonView: View {
|
||
|
||
let price: Int
|
||
let title: String
|
||
let action: () -> ()
|
||
|
||
public init(price: Int, title: String, action: @escaping () -> Void) {
|
||
self.price = price
|
||
self.title = title
|
||
self.action = action
|
||
}
|
||
|
||
public var body: some View {
|
||
ZStack {
|
||
CustomMainButtonView(title: "") {
|
||
action()
|
||
}
|
||
HStack {
|
||
Image("cart", bundle: .module)
|
||
.padding(.horizontal, 16)
|
||
Text(title)
|
||
.robotoFlex(size: 17, font: .bold)
|
||
.foregroundStyle(Color.white)
|
||
.tracking(0)
|
||
.lineSpacing(24)
|
||
Spacer()
|
||
Text("\(price)")
|
||
.foregroundStyle(Color.white)
|
||
.robotoFlex(size: 17, font: .bold)
|
||
Image("Rouble", bundle: .module)
|
||
.padding(.trailing, 16)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
#Preview {
|
||
CartButtonView(price: 500, title: "В корзину") {
|
||
|
||
}
|
||
}
|