@@ -5,28 +5,37 @@ extension View {
55 action: @escaping ( ( ) -> Void ) ,
66 accessibilityLabel: String = POSModalCloseButton . Localization. defaultAccessibilityLabel) -> some View {
77 self . modifier (
8- POSModalCloseButton (
8+ POSModalCloseButtonModifier (
99 closeAction: action,
1010 accessibilityLabel: accessibilityLabel)
1111 )
1212 }
1313}
1414
15- struct POSModalCloseButton : ViewModifier {
15+ struct POSModalCloseButton : View {
16+ let accessibilityLabel : String
17+ let closeAction : ( ) -> Void
18+
19+ var body : some View {
20+ HStack {
21+ Spacer ( )
22+ Button ( action: closeAction, label: {
23+ Text ( Image ( systemName: " xmark " ) )
24+ . font ( . posButtonSymbolMedium)
25+ } )
26+ . foregroundColor ( Color . posOnSurface)
27+ . accessibilityLabel ( accessibilityLabel)
28+ }
29+ }
30+ }
31+
32+ struct POSModalCloseButtonModifier : ViewModifier {
1633 let closeAction : ( ) -> Void
1734 let accessibilityLabel : String
1835
1936 func body( content: Content ) -> some View {
2037 VStack ( spacing: 0 ) {
21- HStack {
22- Spacer ( )
23- Button ( action: closeAction, label: {
24- Text ( Image ( systemName: " xmark " ) )
25- . font ( . posButtonSymbolMedium)
26- } )
27- . foregroundColor ( Color . posOnSurface)
28- . accessibilityLabel ( accessibilityLabel)
29- }
38+ POSModalCloseButton ( accessibilityLabel: accessibilityLabel, closeAction: closeAction)
3039
3140 Spacer ( )
3241
0 commit comments