Skip to content

Commit

Permalink
fix: 🐛 rename shadow name
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyu0722 committed Sep 9, 2024
1 parent e17367c commit 193405d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ struct ShadowEffectExample: View {

@ViewBuilder func styleDescription(_ style: FioriShadowStyle) -> some View {
switch style {
case .minimal:
case .level0:
Text("Level 0")
case .light:
case .level1:
Text("Level 1")
case .medium:
case .level2:
Text("Level 2")
case .heavy:
case .level3:
Text("Level 3")
case .max:
case .level4:
Text("Level 3")
case .compact:
case .smallElement:
Text("Small Shape")
case .broad:
case .mediumElement:
Text("Medium Shape")
}
}
Expand Down
44 changes: 22 additions & 22 deletions Sources/FioriSwiftUICore/Utils/ShadowEffect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import SwiftUI

/// Fiori style shadow.
public enum FioriShadowStyle: CaseIterable {
/// Minimal shadow. Most used in banner, header or previews.
case minimal
/// Light shadow.
case light
/// Medium shadow. Most used in cards or modal views.
case medium
/// Heavy shadow. Most used in toast message or quick sort.
case heavy
/// Max shadow. Most used in popovers.
case max
/// Shadow level 0. Most used in banner, header or previews.
case level0
/// Shadow Level 1.
case level1
/// Shadow Level 2. Most used in cards or modal views.
case level2
/// Shadow Level 3. Most used in toast message or quick sort.
case level3
/// Shadow Level 4. Most used in popovers.
case level4

/// Compact shadow. Most used in switch or slider.
case compact
/// Broad shadow. Most used in segmented control.
case broad
/// Shadow for small element. Most used in switch or slider.
case smallElement
/// Shadow for medium element. Most used in segmented control.
case mediumElement
}

public extension View {
Expand All @@ -40,32 +40,32 @@ struct FioriShadowModifier: ViewModifier {

func body(content: Content) -> some View {
switch self.style {
case .minimal:
case .level0:
content
.shadow(color: self.color1, radius: 1)
case .light:
case .level1:
content
.shadow(color: self.color1, radius: 1)
.shadow(color: self.color2, radius: 2, y: 1)
case .medium:
case .level2:
content
.shadow(color: self.color1, radius: 1)
.shadow(color: self.color2, radius: 4, y: 2)
case .heavy:
case .level3:
content
.shadow(color: self.color1, radius: 2)
.shadow(color: self.color1, radius: 1)
.shadow(color: self.color2, radius: 16, y: 8)
.shadow(color: self.color2, radius: 32, y: 16)
case .max:
case .level4:
content
.shadow(color: self.color2, radius: 1)
.shadow(color: self.color2, radius: 8, y: 8)
.shadow(color: self.color3, radius: 50, y: 10)
case .compact:
case .smallElement:
content
.shadow(color: self.color4, radius: 6.5, y: 6)
.shadow(color: self.color4, radius: 2, y: 0.5)
case .broad:
case .mediumElement:
content
.shadow(color: self.color2, radius: 0.5, y: 3)
.shadow(color: self.color4, radius: 4, y: 3)
Expand Down

0 comments on commit 193405d

Please sign in to comment.