내 보관함, 재생목록 리스트 UI 추가
This commit is contained in:
31
SodaLive/Sources/Content/Box/ContentBoxTabView.swift
Normal file
31
SodaLive/Sources/Content/Box/ContentBoxTabView.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// ContentBoxTabView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 12/7/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentBoxTabView: View {
|
||||
|
||||
let title: String
|
||||
let isSelected: Bool
|
||||
|
||||
var body: some View {
|
||||
Text(title)
|
||||
.font(.custom(Font.medium.rawValue, size: 14.7))
|
||||
.foregroundColor(isSelected ? Color.button : Color.gray77)
|
||||
.padding(.vertical, 8.3)
|
||||
.padding(.horizontal, 13.3)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 26.7)
|
||||
.strokeBorder(lineWidth: 1)
|
||||
.foregroundColor(isSelected ? Color.button : Color.gray77)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentBoxTabView(title: "재생목록", isSelected: false)
|
||||
}
|
58
SodaLive/Sources/Content/Box/ContentBoxView.swift
Normal file
58
SodaLive/Sources/Content/Box/ContentBoxView.swift
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ContentBoxView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 12/7/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentBoxView: View {
|
||||
|
||||
@StateObject var viewModel = ContentBoxViewModel()
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
VStack(spacing: 13.3) {
|
||||
DetailNavigationBar(title: "내 보관함")
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 12) {
|
||||
ContentBoxTabView(
|
||||
title: "구매목록",
|
||||
isSelected: viewModel.currentTab == .orderlist
|
||||
)
|
||||
.onTapGesture {
|
||||
if viewModel.currentTab != .orderlist {
|
||||
viewModel.currentTab = .orderlist
|
||||
}
|
||||
}
|
||||
|
||||
ContentBoxTabView(
|
||||
title: "재생목록",
|
||||
isSelected: viewModel.currentTab == .playlist
|
||||
)
|
||||
.onTapGesture {
|
||||
if viewModel.currentTab != .playlist {
|
||||
viewModel.currentTab = .playlist
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
|
||||
if viewModel.currentTab == .playlist {
|
||||
ContentPlaylistListView()
|
||||
.padding(.bottom, 13.3)
|
||||
.padding(.horizontal, 13.3)
|
||||
} else {
|
||||
OrderListAllInnerView()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentBoxView()
|
||||
}
|
17
SodaLive/Sources/Content/Box/ContentBoxViewModel.swift
Normal file
17
SodaLive/Sources/Content/Box/ContentBoxViewModel.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// ContentBoxViewModel.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 12/7/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
final class ContentBoxViewModel: ObservableObject {
|
||||
enum CurrentTab: String {
|
||||
case playlist, orderlist
|
||||
}
|
||||
|
||||
@Published var currentTab: CurrentTab = .orderlist
|
||||
}
|
Reference in New Issue
Block a user