feat(main): 생성 메뉴를 홈에 추가한다
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorContentCreationFloatingActionMenu: View {
|
||||
@Binding var isPresented: Bool
|
||||
let bottomPadding: CGFloat
|
||||
let onTapCommunityPost: () -> Void
|
||||
let onTapAudioContent: () -> Void
|
||||
let onTapCreateLive: () -> Void
|
||||
|
||||
init(
|
||||
isPresented: Binding<Bool>,
|
||||
bottomPadding: CGFloat = 0,
|
||||
onTapCommunityPost: @escaping () -> Void,
|
||||
onTapAudioContent: @escaping () -> Void,
|
||||
onTapCreateLive: @escaping () -> Void
|
||||
) {
|
||||
_isPresented = isPresented
|
||||
self.bottomPadding = bottomPadding
|
||||
self.onTapCommunityPost = onTapCommunityPost
|
||||
self.onTapAudioContent = onTapAudioContent
|
||||
self.onTapCreateLive = onTapCreateLive
|
||||
}
|
||||
|
||||
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 {
|
||||
CreatorChannelFloatingIconButton(
|
||||
imageName: "ic_new_upload_community_post",
|
||||
backgroundColor: Color.soda400,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.uploadCommunityPost,
|
||||
action: onTapCommunityPost
|
||||
)
|
||||
|
||||
CreatorChannelFloatingIconButton(
|
||||
imageName: "ic_new_upload_audio",
|
||||
backgroundColor: Color.soda400,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.uploadAudioContent,
|
||||
action: onTapAudioContent
|
||||
)
|
||||
|
||||
CreatorChannelFloatingIconButton(
|
||||
imageName: "ic_new_create_live",
|
||||
backgroundColor: Color.soda800,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.createLive,
|
||||
action: onTapCreateLive
|
||||
)
|
||||
|
||||
CreatorChannelFloatingIconButton(
|
||||
imageName: "ic_new_x_black",
|
||||
backgroundColor: Color.white,
|
||||
accessibilityLabel: I18n.CreatorChannelHome.closeFloatingMenu
|
||||
) {
|
||||
withAnimation(animation) {
|
||||
isPresented = false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CreatorChannelFloatingIconButton(
|
||||
imageName: "ic_plus_no_bg",
|
||||
backgroundColor: Color.soda400,
|
||||
accessibilityLabel: "FAB"
|
||||
) {
|
||||
withAnimation(animation) {
|
||||
isPresented = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.trailing, SodaSpacing.s14)
|
||||
.padding(.bottom, bottomPadding)
|
||||
.animation(animation, value: isPresented)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct CreatorContentCreationFloatingActionMenu_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
CreatorContentCreationFloatingActionMenu(
|
||||
isPresented: .constant(false),
|
||||
onTapCommunityPost: {},
|
||||
onTapAudioContent: {},
|
||||
onTapCreateLive: {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user