feat(creator): 본인 채널 액션 기반을 추가한다
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorChannelFloatingActionMenu: View {
|
||||
@Binding var isPresented: Bool
|
||||
let onTapCommunityPost: () -> Void
|
||||
let onTapAudioContent: () -> Void
|
||||
let onTapCreateLive: () -> Void
|
||||
|
||||
private let buttonSize: CGFloat = 66
|
||||
private let animation = Animation.interpolatingSpring(mass: 1, stiffness: 256, damping: 24, initialVelocity: 0)
|
||||
|
||||
var body: some View {
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
if isPresented {
|
||||
Color.black
|
||||
.opacity(0.4)
|
||||
.ignoresSafeArea()
|
||||
.onTapGesture {
|
||||
withAnimation(animation) {
|
||||
isPresented = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VStack(spacing: SodaSpacing.s14) {
|
||||
if isPresented {
|
||||
floatingButton(
|
||||
imageName: "ic_new_upload_community_post",
|
||||
backgroundColor: Color.soda400,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.uploadCommunityPost,
|
||||
action: onTapCommunityPost
|
||||
)
|
||||
|
||||
floatingButton(
|
||||
imageName: "ic_new_upload_audio",
|
||||
backgroundColor: Color.soda400,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.uploadAudioContent,
|
||||
action: onTapAudioContent
|
||||
)
|
||||
|
||||
floatingButton(
|
||||
imageName: "ic_new_create_live",
|
||||
backgroundColor: Color.soda800,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.createLive,
|
||||
action: onTapCreateLive
|
||||
)
|
||||
|
||||
floatingButton(
|
||||
imageName: "ic_new_x_black",
|
||||
backgroundColor: Color.white,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.closeFloatingMenu
|
||||
) {
|
||||
withAnimation(animation) {
|
||||
isPresented = false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
floatingButton(
|
||||
imageName: "ic_plus_no_bg",
|
||||
backgroundColor: Color.soda400,
|
||||
accessibilityLabel: "FAB"
|
||||
) {
|
||||
withAnimation(animation) {
|
||||
isPresented = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.trailing, SodaSpacing.s20)
|
||||
.padding(.bottom, SodaSpacing.s32)
|
||||
.animation(animation, value: isPresented)
|
||||
}
|
||||
}
|
||||
|
||||
private func floatingButton(
|
||||
imageName: String,
|
||||
backgroundColor: Color,
|
||||
accessibilityLabel: String,
|
||||
action: @escaping () -> Void
|
||||
) -> some View {
|
||||
Button(action: action) {
|
||||
Image(imageName)
|
||||
.resizable()
|
||||
.frame(width: 38, height: 38)
|
||||
.frame(width: buttonSize, height: buttonSize)
|
||||
.background(backgroundColor)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.accessibilityLabel(accessibilityLabel)
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelFloatingActionMenu_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
CreatorChannelFloatingActionMenu(
|
||||
isPresented: .constant(false),
|
||||
onTapCommunityPost: {},
|
||||
onTapAudioContent: {},
|
||||
onTapCreateLive: {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user