내 보관함, 재생목록 리스트 UI 추가
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ContentPlaylistListView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 12/7/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentPlaylistListView: View {
|
||||
|
||||
@ObservedObject var viewModel = ContentPlaylistListViewModel()
|
||||
|
||||
var body: some View {
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
VStack(spacing: 13.3) {
|
||||
Text("+ 새 재생목록 만들기")
|
||||
.font(.custom(Font.bold.rawValue, size: 14.7))
|
||||
.foregroundColor(Color.white)
|
||||
.padding(.vertical, 13.3)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.button)
|
||||
.cornerRadius(5.3)
|
||||
.onTapGesture {
|
||||
}
|
||||
|
||||
if viewModel.playlists.isEmpty {
|
||||
VStack(spacing: 13.3) {
|
||||
Text("재생목록이 비어있습니다.")
|
||||
.font(.custom(Font.bold.rawValue, size: 14.7))
|
||||
.foregroundColor(Color.grayee)
|
||||
|
||||
Text("자주 듣는 콘텐츠를\n재생목록으로 만들어 보세요.")
|
||||
.font(.custom(Font.medium.rawValue, size: 11))
|
||||
.foregroundColor(Color.grayee)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(Color.bg)
|
||||
.cornerRadius(4.7)
|
||||
} else {
|
||||
HStack(spacing: 5.3) {
|
||||
Text("전체")
|
||||
.font(.custom(Font.medium.rawValue, size: 14.7))
|
||||
.foregroundColor(Color.white)
|
||||
|
||||
Text("\(viewModel.totalCount)개")
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color.gray90)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
ForEach(0..<viewModel.playlists.count, id: \.self) { index in
|
||||
let playlist = viewModel.playlists[index]
|
||||
|
||||
ContentPlaylistItemView(item: playlist)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.getPlaylistList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentPlaylistListView()
|
||||
}
|
||||
Reference in New Issue
Block a user