크리에이터 커뮤니티 페이지 추가

This commit is contained in:
Yu Sung 2023-12-15 19:14:03 +09:00
parent b8fbb664d5
commit 650b6808e6
11 changed files with 331 additions and 2 deletions

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "img_sample.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

View File

@ -111,4 +111,6 @@ enum AppStep {
case curationAll(title: String, curationId: Int)
case contentRankingAll
case creatorCommunityAll(creatorId: Int)
}

View File

@ -163,6 +163,9 @@ struct ContentView: View {
case .contentRankingAll:
ContentRankingAllView()
case .creatorCommunityAll(let creatorId):
CreatorCommunityAllView(creatorId: creatorId)
default:
EmptyView()
.frame(width: 0, height: 0, alignment: .topLeading)

View File

@ -0,0 +1,40 @@
//
// IconAndTitleButton.swift
// SodaLive
//
// Created by klaus on 2023/12/15.
//
import SwiftUI
struct IconAndTitleButton: View {
let iconName: String
let title: String
let onClick: () -> Void
var body: some View {
HStack(spacing: 4) {
Image(iconName)
Text(title)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
}
.padding(.horizontal, 13.3)
.padding(.vertical, 5.3)
.background(Color(hex: "ffffff").opacity(0.1))
.cornerRadius(26.7)
.onTapGesture { onClick() }
}
}
struct IconAndTitleButton_Previews: PreviewProvider {
static var previews: some View {
IconAndTitleButton(
iconName: "ic_audio_content_share",
title: "공유",
onClick: {}
)
}
}

View File

@ -0,0 +1,45 @@
//
// IconAndTitleToggleButton.swift
// SodaLive
//
// Created by klaus on 2023/12/15.
//
import SwiftUI
struct IconAndTitleToggleButton: View {
@Binding var isChecked: Bool
let title: String
let normalIconName: String
let checkedIconName: String
let onClick: () -> Void
var body: some View {
HStack(spacing: 4) {
Image(isChecked ? checkedIconName : normalIconName)
Text("\(title)")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
}
.padding(.horizontal, 13.3)
.padding(.vertical, 5.3)
.background(Color(hex: "ffffff").opacity(0.1))
.cornerRadius(26.7)
.onTapGesture { onClick() }
}
}
struct IconAndTitleToggleButton_Previews: PreviewProvider {
static var previews: some View {
IconAndTitleToggleButton(
isChecked: .constant(true),
title: "100",
normalIconName: "ic_audio_content_heart_normal",
checkedIconName: "ic_audio_content_heart_pressed"
) {}
}
}

View File

@ -8,6 +8,9 @@
import SwiftUI
struct CreatorCommunityMoreItemView: View {
let onClick: () -> Void
var body: some View {
VStack(spacing: 11) {
Image("btn_item_more")
@ -18,11 +21,12 @@ struct CreatorCommunityMoreItemView: View {
.font(.custom(Font.light.rawValue, size: 11))
.foregroundColor(Color(hex: "bbbbbb"))
}
.onTapGesture { onClick() }
}
}
struct CreatorCommunityMoreItemView_Previews: PreviewProvider {
static var previews: some View {
CreatorCommunityMoreItemView()
CreatorCommunityMoreItemView {}
}
}

View File

@ -0,0 +1,80 @@
//
// CreatorCommunityAllItemView.swift
// SodaLive
//
// Created by klaus on 2023/12/15.
//
import SwiftUI
struct CreatorCommunityAllItemView: View {
@State var isExpandContent = true
var body: some View {
VStack(spacing: 13.3) {
HStack(spacing: 0) {
Image("ic_place_holder")
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
VStack(alignment: .leading, spacing: 3) {
Text("민하나")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Text("1개월 전(수정됨)")
.font(.custom(Font.light.rawValue, size: 13.3))
.foregroundColor(Color(hex: "777777"))
}
.padding(.leading, 11)
Spacer()
Image("ic_seemore_vertical")
.padding(.trailing, 8.3)
.onTapGesture {}
}
Text("너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "bbbbbb"))
.fixedSize(horizontal: false, vertical: true)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(isExpandContent ? Int.max : 3)
.onTapGesture { isExpandContent.toggle() }
Image("img_sample")
.resizable()
.frame(maxWidth: .infinity)
.scaledToFit()
HStack(spacing: 8) {
IconAndTitleToggleButton(
isChecked: .constant(true),
title: "252",
normalIconName: "ic_audio_content_heart_normal",
checkedIconName: "ic_audio_content_heart_pressed"
) {}
IconAndTitleButton(iconName: "ic_audio_content_share", title: "공유") {}
}
.frame(maxWidth: .infinity, alignment: .leading)
CreatorCommunityCommentView(
commentCount: 2,
commentList: [
"내용 읽어보니까 결혼해도 될것 같은데",
"너무 조하유 앞으로도 좋은 라이브 많이 들려주세요"
],
registerComment: { _ in }
)
}
}
}
struct CreatorCommunityAllItemView_Previews: PreviewProvider {
static var previews: some View {
CreatorCommunityAllItemView()
}
}

View File

@ -0,0 +1,37 @@
//
// CreatorCommunityAllView.swift
// SodaLive
//
// Created by klaus on 2023/12/15.
//
import SwiftUI
struct CreatorCommunityAllView: View {
let creatorId: Int
var body: some View {
BaseView {
VStack(spacing: 0) {
DetailNavigationBar(title: "커뮤니티")
ScrollView(.vertical, showsIndicators: false) {
LazyVStack(spacing: 26.7) {
CreatorCommunityAllItemView()
CreatorCommunityAllItemView()
CreatorCommunityAllItemView()
}
.padding(.horizontal, 13.3)
.padding(.vertical, 5.3)
}
}
}
}
}
struct CreatorCommunityAllView_Previews: PreviewProvider {
static var previews: some View {
CreatorCommunityAllView(creatorId: 0)
}
}

View File

@ -0,0 +1,93 @@
//
// CreatorCommunityCommentView.swift
// SodaLive
//
// Created by klaus on 2023/12/15.
//
import SwiftUI
struct CreatorCommunityCommentView: View {
let commentCount: Int
let commentList: [String]
let registerComment: (String) -> Void
@State private var comment = ""
var body: some View {
VStack(alignment: .leading, spacing: 11) {
HStack(spacing: 5.3) {
Text("댓글")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(.white)
Text("\(commentCount)")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "909090"))
Spacer()
}
HStack(spacing: 8) {
Image("ic_place_holder")
.resizable()
.frame(width: 33.3, height: 33.3)
.clipShape(Circle())
if commentCount > 0 {
Text(commentList[0])
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "bbbbbb"))
.lineLimit(1)
.padding(.leading, 3)
} else {
HStack(spacing: 0) {
TextField("댓글을 입력해 보세요.", text: $comment)
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.accentColor(Color(hex: "3bb9f1"))
.keyboardType(.default)
.padding(.horizontal, 13.3)
Spacer()
Image("btn_message_send")
.resizable()
.frame(width: 35, height: 35)
.padding(6.7)
.onTapGesture {
hideKeyboard()
registerComment(comment)
}
}
.background(Color(hex: "232323"))
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "3bb9f1"))
)
}
}
}
.padding(11)
.background(Color(hex: "ffffff").opacity(0.1))
.cornerRadius(5.3)
}
}
struct CreatorCommunityCommentView_Previews: PreviewProvider {
static var previews: some View {
CreatorCommunityCommentView(
commentCount: 0,
commentList: [
"내용 읽어보니까 결혼해도 될것 같은데",
"너무 조하유 앞으로도 좋은 라이브 많이 들려주세요"
],
registerComment: { _ in }
)
}
}

View File

@ -74,7 +74,11 @@ struct UserProfileView: View {
CreatorCommunityItemView()
.frame(width: 320)
CreatorCommunityMoreItemView()
CreatorCommunityMoreItemView {
AppState.shared.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
}
.padding(.horizontal, 15)
}