룰렛 설정 다이얼로그 뷰 추가
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// RouletteSettingsOptionView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/05.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RouletteSettingsOptionView: View {
|
||||
|
||||
@ObservedObject var option: RouletteOption
|
||||
|
||||
let index: Int
|
||||
|
||||
let onClickPlus: () -> Void
|
||||
let onClickDelete: () -> Void
|
||||
let onClickSubstract: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 6.7) {
|
||||
HStack(spacing: 0) {
|
||||
Text("옵션 \(index + 1)")
|
||||
.font(.custom(Font.medium.rawValue, size: 14.7))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
|
||||
Spacer()
|
||||
|
||||
if index > 1 {
|
||||
Text("삭제")
|
||||
.font(.custom(Font.medium.rawValue, size: 14.7))
|
||||
.foregroundColor(Color(hex: "ff5c49"))
|
||||
.onTapGesture { onClickDelete() }
|
||||
}
|
||||
}
|
||||
|
||||
HStack(spacing: 8) {
|
||||
TextField("옵션을 입력하세요", text: $option.title)
|
||||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
.keyboardType(.default)
|
||||
.padding(.horizontal, 13.3)
|
||||
.padding(.vertical, 16.7)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color(hex: "222222"))
|
||||
.cornerRadius(6.7)
|
||||
|
||||
Text("\(option.percentage)%")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
.padding(.horizontal, 13.3)
|
||||
.padding(.vertical, 16.7)
|
||||
.background(Color(hex: "222222"))
|
||||
.cornerRadius(6.7)
|
||||
|
||||
Image("btn_minus_round_rect")
|
||||
.onTapGesture { onClickSubstract() }
|
||||
|
||||
Image("btn_plus_round_rect")
|
||||
.onTapGesture { onClickPlus() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RouletteSettingsOptionView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
RouletteSettingsOptionView(
|
||||
option: RouletteOption(title: "옵션1", weight: 1),
|
||||
index: 2,
|
||||
onClickPlus: {},
|
||||
onClickDelete: {},
|
||||
onClickSubstract: {}
|
||||
)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user