Skip to content

Commit

Permalink
fix: Modal ux
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhello0507 committed Dec 6, 2024
1 parent a921c8f commit 3e23393
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/DDS/Component/Modal/BaseModal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import Foundation
import SwiftUI

struct BaseModal<MC: View, C: View>: View {

@Namespace var animation
@State private var scaleEffect: CGFloat = 1.2
@Binding var isPresent: Bool
@State var opacity: Double = 0.0
let backgroundColor: DodamColorable = DodamColor.Background.normal
let cornerRadius: CGFloat = 16
// let shadow: SeugiShadowSystem = .evBlack(.ev1)
@ViewBuilder let content: () -> C
@ViewBuilder let modalContent: () -> MC

Expand All @@ -19,21 +17,22 @@ struct BaseModal<MC: View, C: View>: View {
Color.black
.opacity(0.2 * opacity)
.ignoresSafeArea()
.onTapGesture {
self.isPresent = false
}
// MARK: - Modal Content
VStack {
Spacer()
if isPresent {
modalContent()
.background(backgroundColor)
.cornerRadius(cornerRadius)
// .shadow(shadow)
.scaleEffect(scaleEffect)
.opacity(opacity)
} else {
modalContent()
.background(backgroundColor)
.cornerRadius(cornerRadius)
// .shadow(shadow)
.opacity(opacity)
}
Spacer()
Expand Down

0 comments on commit 3e23393

Please sign in to comment.