Files
sodalive-ios/SodaLive/Sources/V2/CreatorChannel/Components/CreatorChannelFloatingActionMenu.swift
2026-07-05 00:44:03 +09:00

89 lines
3.2 KiB
Swift

import SwiftUI
struct CreatorChannelFloatingActionMenu: View {
@Binding var isPresented: Bool
let onTapCommunityPost: () -> Void
let onTapAudioContent: () -> Void
let onTapCreateLive: () -> Void
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)
.animation(animation, value: isPresented)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
}
}
struct CreatorChannelFloatingActionMenu_Previews: PreviewProvider {
static var previews: some View {
ZStack {
Color.black.ignoresSafeArea()
CreatorChannelFloatingActionMenu(
isPresented: .constant(false),
onTapCommunityPost: {},
onTapAudioContent: {},
onTapCreateLive: {}
)
}
}
}