@@ -19,18 +19,106 @@ struct SampleCardView: View {
1919  let  sample :  Sample 
2020
2121  var  body :  some  View  { 
22-     VStack ( alignment:  . leading)  { 
23-       Text ( sample. title) 
24-         . font ( . system( size:  17 ,  weight:  . medium) ) 
22+     GroupBox  { 
2523      Text ( sample. description) 
2624        . font ( . system( size:  14 ) ) 
2725        . foregroundColor ( . secondary) 
28-         . padding ( . top,  4 ) 
26+         . frame ( maxWidth:  . infinity,  maxHeight:  . infinity,  alignment:  . topLeading) 
27+     }  label:  { 
28+       HStack  { 
29+         if  let  useCase =  sample. useCases. first { 
30+           Image ( systemName:  systemName ( for:  useCase) ) 
31+             . foregroundColor ( color ( for:  useCase) ) 
32+         } 
33+         Text ( sample. title) 
34+           . font ( . system( size:  17 ,  weight:  . medium) ) 
35+       } 
2936    } 
30-     . padding ( ) 
37+     . groupBoxStyle ( CardGroupBoxStyle ( ) ) 
3138    . frame ( maxWidth:  . infinity,  minHeight:  150 ,  maxHeight:  . infinity,  alignment:  . top) 
32-     . background ( Color . white) 
33-     . cornerRadius ( 12 ) 
34-     . shadow ( radius:  3 ) 
3539  } 
40+ 
41+   private  func  systemName( for useCase:  UseCase )  ->  String  { 
42+     switch  useCase { 
43+     case  . text:  " text.bubble.fill " 
44+     case  . image:  " photo.fill " 
45+     case  . video:  " video.fill " 
46+     case  . audio:  " waveform " 
47+     case  . document:  " doc.fill " 
48+     case  . functionCalling:  " gearshape.2.fill " 
49+     } 
50+   } 
51+ 
52+   private  func  color( for useCase:  UseCase )  ->  Color  { 
53+     switch  useCase { 
54+     case  . text: . blue
55+     case  . image: . purple
56+     case  . video: . red
57+     case  . audio: . orange
58+     case  . document: . gray
59+     case  . functionCalling: . green
60+     } 
61+   } 
62+ } 
63+ 
64+ public  struct  CardGroupBoxStyle :  GroupBoxStyle  { 
65+   private  var  cornerRadius :  CGFloat  { 
66+     if  #available( iOS 26 . 0 ,  * )  { 
67+       return  28 
68+     }  else  { 
69+       return  12 
70+     } 
71+   } 
72+ 
73+   public  func  makeBody( configuration:  Configuration )  ->  some  View  { 
74+     VStack ( alignment:  . leading,  spacing:  12 )  { 
75+       configuration. label
76+       configuration. content
77+     } 
78+     . padding ( ) 
79+     . background ( Color ( . secondarySystemGroupedBackground) ) 
80+     . clipShape ( RoundedRectangle ( cornerRadius:  cornerRadius,  style:  . continuous) ) 
81+   } 
82+ } 
83+ 
84+ #Preview { 
85+   let  samples  =  [ 
86+     Sample ( 
87+       title:  " Sample 1 " , 
88+       description:  " This is the first sample card. " , 
89+       useCases:  [ . text] , 
90+       navRoute:  " ConversationScreen " 
91+     ) , 
92+     Sample ( 
93+       title:  " Sample 2 " , 
94+       description:  " This is the second sample card. " , 
95+       useCases:  [ . image] , 
96+       navRoute:  " PhotoReasoningScreen " 
97+     ) , 
98+     Sample ( 
99+       title:  " Sample 3 " , 
100+       description:  " This is the third sample card. " , 
101+       useCases:  [ . video] , 
102+       navRoute:  " ConversationScreen " 
103+     ) , 
104+     Sample ( 
105+       title:  " Sample 4 " , 
106+       description:  " This is the fourth sample card, which is a bit longer to see how the text wraps and if everything still aligns correctly. " , 
107+       useCases:  [ . audio] , 
108+       navRoute:  " ConversationScreen " 
109+     ) , 
110+   ] 
111+ 
112+   ScrollView  { 
113+     LazyVGrid ( columns:  [ 
114+       GridItem ( . flexible( ) ) , 
115+       GridItem ( . flexible( ) ) , 
116+     ] ,  spacing:  16 )  { 
117+       ForEach ( samples)  {  sample in 
118+         SampleCardView ( sample:  sample) 
119+       } 
120+     } 
121+     . padding ( ) 
122+   } 
123+   . background ( Color ( . systemGroupedBackground) ) 
36124} 
0 commit comments