콘텐츠 상세 - 콘텐츠 고정/해제 기능 추가

This commit is contained in:
Yu Sung
2024-01-29 15:22:45 +09:00
parent bd818918f3
commit 12d2c09434
14 changed files with 318 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ struct CreatorCommunityAllView: View {
ZStack {
if viewModel.isShowReportMenu {
VStack(spacing: 0) {
ContentDetailMenuView(
CreatorCommunityMenuView(
isShowing: $viewModel.isShowReportMenu,
isShowCreatorMenu: creatorId == UserDefaults.int(forKey: .userId),
modifyAction: {

View File

@@ -0,0 +1,97 @@
//
// CreatorCommunityMenuView.swift
// SodaLive
//
// Created by klaus on 1/29/24.
//
import SwiftUI
struct CreatorCommunityMenuView: View {
@Binding var isShowing: Bool
let isShowCreatorMenu: Bool
let modifyAction: () -> Void
let deleteAction: () -> Void
let reportAction: () -> Void
var body: some View {
ZStack {
Color.black
.opacity(0.7)
.ignoresSafeArea()
.onTapGesture { isShowing = false }
VStack(spacing: 0) {
Spacer()
VStack(spacing: 13.3) {
if isShowCreatorMenu {
HStack(spacing: 13.3) {
Image("ic_make_message")
Text("수정")
.font(.custom(Font.medium.rawValue, size: 16.7))
.foregroundColor(.white)
Spacer()
}
.padding(.vertical, 8)
.padding(.horizontal, 26.7)
.contentShape(Rectangle())
.onTapGesture {
isShowing = false
modifyAction()
}
HStack(spacing: 13.3) {
Image("ic_trash_can")
Text("삭제")
.font(.custom(Font.medium.rawValue, size: 16.7))
.foregroundColor(.white)
Spacer()
}
.padding(.vertical, 8)
.padding(.horizontal, 26.7)
.contentShape(Rectangle())
.onTapGesture {
isShowing = false
deleteAction()
}
} else {
HStack(spacing: 0) {
Text("신고")
.font(.custom(Font.medium.rawValue, size: 16.7))
.foregroundColor(.white)
Spacer()
}
.padding(.vertical, 8)
.padding(.horizontal, 26.7)
.contentShape(Rectangle())
.onTapGesture {
isShowing = false
reportAction()
}
}
}
.padding(24)
.background(Color(hex: "222222"))
.cornerRadius(13.3, corners: [.topLeft, .topRight])
}
}
}
}
#Preview {
CreatorCommunityMenuView(
isShowing: .constant(true),
isShowCreatorMenu: true,
modifyAction: {},
deleteAction: {},
reportAction: {}
)
}