feat(creator): 본인 채널 액션 기반을 추가한다
This commit is contained in:
@@ -5,6 +5,7 @@ struct CreatorChannelTitleBar: View {
|
||||
let isFollow: Bool
|
||||
let isNotify: Bool
|
||||
let backgroundProgress: CGFloat
|
||||
let showsCreatorActions: Bool
|
||||
let onTapBack: () -> Void
|
||||
let onTapFollow: () -> Void
|
||||
let onTapUnfollow: () -> Void
|
||||
@@ -12,6 +13,32 @@ struct CreatorChannelTitleBar: View {
|
||||
let onTapUnnotify: () -> Void
|
||||
let onTapMore: () -> Void
|
||||
|
||||
init(
|
||||
nickname: String,
|
||||
isFollow: Bool,
|
||||
isNotify: Bool,
|
||||
backgroundProgress: CGFloat,
|
||||
showsCreatorActions: Bool = true,
|
||||
onTapBack: @escaping () -> Void,
|
||||
onTapFollow: @escaping () -> Void,
|
||||
onTapUnfollow: @escaping () -> Void,
|
||||
onTapNotify: @escaping () -> Void,
|
||||
onTapUnnotify: @escaping () -> Void,
|
||||
onTapMore: @escaping () -> Void
|
||||
) {
|
||||
self.nickname = nickname
|
||||
self.isFollow = isFollow
|
||||
self.isNotify = isNotify
|
||||
self.backgroundProgress = backgroundProgress
|
||||
self.showsCreatorActions = showsCreatorActions
|
||||
self.onTapBack = onTapBack
|
||||
self.onTapFollow = onTapFollow
|
||||
self.onTapUnfollow = onTapUnfollow
|
||||
self.onTapNotify = onTapNotify
|
||||
self.onTapUnnotify = onTapUnnotify
|
||||
self.onTapMore = onTapMore
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: SodaSpacing.s12) {
|
||||
Button(action: onTapBack) {
|
||||
@@ -29,21 +56,23 @@ struct CreatorChannelTitleBar: View {
|
||||
.opacity(backgroundProgress >= 1 ? 1 : 0)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
HStack(spacing: SodaSpacing.s14) {
|
||||
followButton
|
||||
if showsCreatorActions {
|
||||
HStack(spacing: SodaSpacing.s14) {
|
||||
followButton
|
||||
|
||||
if isFollow {
|
||||
notifyButton
|
||||
}
|
||||
if isFollow {
|
||||
notifyButton
|
||||
}
|
||||
|
||||
Button(action: onTapMore) {
|
||||
Image("ic_new_more")
|
||||
.resizable()
|
||||
.frame(width: 24, height: 24)
|
||||
Button(action: onTapMore) {
|
||||
Image("ic_new_more")
|
||||
.resizable()
|
||||
.frame(width: 24, height: 24)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.layoutPriority(1)
|
||||
}
|
||||
.layoutPriority(1)
|
||||
}
|
||||
.padding(.horizontal, SodaSpacing.s14)
|
||||
.frame(height: 56)
|
||||
@@ -93,6 +122,7 @@ struct CreatorChannelTitleBar_Previews: PreviewProvider {
|
||||
isFollow: false,
|
||||
isNotify: false,
|
||||
backgroundProgress: 1,
|
||||
showsCreatorActions: true,
|
||||
onTapBack: {},
|
||||
onTapFollow: {},
|
||||
onTapUnfollow: {},
|
||||
@@ -106,6 +136,7 @@ struct CreatorChannelTitleBar_Previews: PreviewProvider {
|
||||
isFollow: true,
|
||||
isNotify: true,
|
||||
backgroundProgress: 1,
|
||||
showsCreatorActions: true,
|
||||
onTapBack: {},
|
||||
onTapFollow: {},
|
||||
onTapUnfollow: {},
|
||||
@@ -119,6 +150,21 @@ struct CreatorChannelTitleBar_Previews: PreviewProvider {
|
||||
isFollow: true,
|
||||
isNotify: false,
|
||||
backgroundProgress: 1,
|
||||
showsCreatorActions: true,
|
||||
onTapBack: {},
|
||||
onTapFollow: {},
|
||||
onTapUnfollow: {},
|
||||
onTapNotify: {},
|
||||
onTapUnnotify: {},
|
||||
onTapMore: {}
|
||||
)
|
||||
|
||||
CreatorChannelTitleBar(
|
||||
nickname: "Soda Creator",
|
||||
isFollow: true,
|
||||
isNotify: true,
|
||||
backgroundProgress: 1,
|
||||
showsCreatorActions: false,
|
||||
onTapBack: {},
|
||||
onTapFollow: {},
|
||||
onTapUnfollow: {},
|
||||
|
||||
Reference in New Issue
Block a user