40 lines
1.2 KiB
Swift
40 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct CreatorChannelReplyDetailActionPopup: View {
|
|
let canEdit: Bool
|
|
let canDelete: Bool
|
|
let onTapEdit: () -> Void
|
|
let onTapDelete: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 0) {
|
|
if canEdit {
|
|
actionButton(title: I18n.Explorer.edit, action: onTapEdit)
|
|
}
|
|
|
|
if canDelete {
|
|
actionButton(title: I18n.Common.delete, action: onTapDelete)
|
|
}
|
|
}
|
|
.background(Color.gray900)
|
|
.cornerRadius(14)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 14, style: .continuous)
|
|
.stroke(Color.gray700, lineWidth: 1)
|
|
)
|
|
}
|
|
|
|
private func actionButton(title: String, action: @escaping () -> Void) -> some View {
|
|
Button(action: action) {
|
|
Text(title)
|
|
.appFont(size: 14, weight: .medium)
|
|
.foregroundColor(.white)
|
|
.lineLimit(1)
|
|
.frame(minWidth: 80, alignment: .leading)
|
|
.padding(.horizontal, SodaSpacing.s12)
|
|
.padding(.vertical, SodaSpacing.s8)
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
}
|