97 lines
3.1 KiB
Swift
97 lines
3.1 KiB
Swift
//
|
|
// LiveRoomMenuSelectView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 3/8/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct LiveRoomMenuSelectView: View {
|
|
|
|
@Binding var menu: String
|
|
@Binding var isActivate: Bool
|
|
|
|
let menuCount: Int
|
|
let selectedMenu: SelectedMenu?
|
|
let selectMenu: (SelectedMenu) -> Void
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 0) {
|
|
Text("메뉴")
|
|
.font(.custom(Font.bold.rawValue, size: 16.7))
|
|
.foregroundColor(Color(hex: "eeeeee"))
|
|
|
|
HStack(spacing: 0) {
|
|
Text("메뉴를 활성화 하시겠습니까?")
|
|
.font(.custom(Font.medium.rawValue, size: 13.3))
|
|
.foregroundColor(Color(hex: "eeeeee"))
|
|
|
|
Spacer()
|
|
|
|
Image(isActivate ? "btn_toggle_on_big" : "btn_toggle_off_big")
|
|
.resizable()
|
|
.frame(width: 33.3, height: 20)
|
|
.onTapGesture {
|
|
isActivate.toggle()
|
|
selectMenu(.MENU_1)
|
|
}
|
|
}
|
|
.padding(.top, 8)
|
|
|
|
if isActivate {
|
|
VStack(spacing: 13.3) {
|
|
HStack(spacing: 13.3) {
|
|
SelectedButtonView(
|
|
title: "메뉴 1",
|
|
isActive: true,
|
|
isSelected: selectedMenu == .MENU_1
|
|
)
|
|
.onTapGesture {
|
|
selectMenu(.MENU_1)
|
|
}
|
|
|
|
SelectedButtonView(
|
|
title: "메뉴 2",
|
|
isActive: menuCount > 0,
|
|
isSelected: selectedMenu == .MENU_2
|
|
)
|
|
.onTapGesture {
|
|
selectMenu(.MENU_2)
|
|
}
|
|
|
|
SelectedButtonView(
|
|
title: "메뉴 3",
|
|
isActive: menuCount > 1,
|
|
isSelected: selectedMenu == .MENU_3
|
|
)
|
|
.onTapGesture {
|
|
selectMenu(.MENU_3)
|
|
}
|
|
}
|
|
|
|
TextViewWrapper(
|
|
text: $menu,
|
|
placeholder: "메뉴판을 작성해주세요.",
|
|
textColorHex: "eeeeee",
|
|
backgroundColorHex: "303030"
|
|
)
|
|
.frame(height: 200)
|
|
.cornerRadius(6.7)
|
|
}
|
|
.padding(.top, 13.3)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
LiveRoomMenuSelectView(
|
|
menu: .constant("메뉴 1 입니다\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n테스트"),
|
|
isActivate: .constant(true),
|
|
menuCount: 2,
|
|
selectedMenu: .MENU_1,
|
|
selectMenu: { _ in }
|
|
)
|
|
}
|