File tree Expand file tree Collapse file tree
Core/Sources/SuggestionWidget Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,12 +45,16 @@ extension NSAppearance {
4545 }
4646}
4747
48- extension View {
49- func xcodeStyleFrame( cornerRadius: Double = 8 ) -> some View {
50- clipShape ( RoundedRectangle ( cornerRadius: cornerRadius, style: . continuous) )
51- . overlay (
48+ struct XcodeLikeFrame < Content: View > : View {
49+ @Environment ( \. colorScheme) var colorScheme
50+ let content : Content
51+ let cornerRadius : Double
52+
53+ var body : some View {
54+ content. clipShape ( RoundedRectangle ( cornerRadius: cornerRadius, style: . continuous) )
55+ . background (
5256 RoundedRectangle ( cornerRadius: cornerRadius, style: . continuous)
53- . stroke ( Color . black . opacity ( 0.3 ) , style : . init ( lineWidth : 1 ) )
57+ . fill ( Material . bar )
5458 )
5559 . overlay (
5660 RoundedRectangle ( cornerRadius: max ( 0 , cornerRadius - 1 ) , style: . continuous)
@@ -60,6 +64,12 @@ extension View {
6064 }
6165}
6266
67+ extension View {
68+ func xcodeStyleFrame( cornerRadius: Double = 10 ) -> some View {
69+ XcodeLikeFrame ( content: self , cornerRadius: cornerRadius)
70+ }
71+ }
72+
6373extension MarkdownUI . Theme {
6474 static func custom( fontSize: Double ) -> MarkdownUI . Theme {
6575 . gitHub. text {
Original file line number Diff line number Diff line change @@ -143,13 +143,7 @@ struct CodeBlockSuggestionPanel: View {
143143 } ( )
144144 ) )
145145 . frame ( width: 450 , height: 400 )
146- . background {
147- HStack {
148- Color . red
149- Color . green
150- Color . blue
151- }
152- }
146+ . padding ( )
153147}
154148
155149#Preview( " Code Block Suggestion Panel Compact Mode " ) {
@@ -178,13 +172,7 @@ struct CodeBlockSuggestionPanel: View {
178172 ) )
179173 . preferredColorScheme ( . light)
180174 . frame ( width: 450 , height: 400 )
181- . background {
182- HStack {
183- Color . red
184- Color . green
185- Color . blue
186- }
187- }
175+ . padding ( )
188176}
189177
190178#Preview( " Code Block Suggestion Panel Highlight ObjC " ) {
@@ -201,12 +189,6 @@ struct CodeBlockSuggestionPanel: View {
201189 ) )
202190 . preferredColorScheme ( . light)
203191 . frame ( width: 450 , height: 400 )
204- . background {
205- HStack {
206- Color . red
207- Color . green
208- Color . blue
209- }
210- }
192+ . padding ( )
211193}
212194
You can’t perform that action at this time.
0 commit comments