@@ -18,89 +18,31 @@ export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
18
18
...divProps
19
19
} ) => {
20
20
return (
21
- < div
22
- css = { ( theme ) => ( {
23
- width : "320px" ,
24
- padding : 24 ,
25
- borderRadius : 6 ,
26
- border : `1px solid ${ theme . palette . divider } ` ,
27
- textAlign : "left" ,
28
- textDecoration : "none" ,
29
- color : "inherit" ,
30
- display : "flex" ,
31
- flexDirection : "column" ,
32
- } ) }
33
- { ...divProps }
34
- >
35
- < div
36
- css = { {
37
- display : "flex" ,
38
- alignItems : "center" ,
39
- justifyContent : "space-between" ,
40
- marginBottom : 24 ,
41
- } }
42
- >
43
- < div
44
- css = { {
45
- flexShrink : 0 ,
46
- paddingTop : 4 ,
47
- width : 32 ,
48
- height : 32 ,
49
- } }
50
- >
21
+ < div css = { styles . card } { ...divProps } >
22
+ < div css = { styles . header } >
23
+ < div css = { styles . icon } >
51
24
< ExternalImage
52
25
src = { example . icon }
53
26
css = { { width : "100%" , height : "100%" , objectFit : "contain" } }
54
27
/>
55
28
</ div >
56
29
57
- < div
58
- css = { {
59
- display : "flex" ,
60
- flexWrap : "wrap" ,
61
- gap : 8 ,
62
- justifyContent : "end" ,
63
- } }
64
- >
65
- { example . tags . map ( ( tag ) => {
66
- const isActive = activeTag === tag ;
67
-
68
- return (
69
- < RouterLink key = { tag } to = { `/starter-templates?tag=${ tag } ` } >
70
- < Pill
71
- css = { ( theme ) => ( {
72
- borderColor : isActive
73
- ? theme . palette . primary . main
74
- : theme . palette . divider ,
75
- cursor : "pointer" ,
76
- backgroundColor : isActive
77
- ? theme . palette . primary . dark
78
- : undefined ,
79
- "&: hover" : {
80
- borderColor : theme . palette . primary . main ,
81
- } ,
82
- } ) }
83
- >
84
- { tag }
85
- </ Pill >
86
- </ RouterLink >
87
- ) ;
88
- } ) }
30
+ < div css = { styles . tags } >
31
+ { example . tags . map ( ( tag ) => (
32
+ < RouterLink key = { tag } to = { `/starter-templates?tag=${ tag } ` } >
33
+ < Pill css = { [ styles . tag , activeTag === tag && styles . activeTag ] } >
34
+ { tag }
35
+ </ Pill >
36
+ </ RouterLink >
37
+ ) ) }
89
38
</ div >
90
39
</ div >
91
40
92
41
< div >
93
42
< h4 css = { { fontSize : 14 , fontWeight : 600 , margin : 0 , marginBottom : 4 } } >
94
43
{ example . name }
95
44
</ h4 >
96
- < span
97
- css = { ( theme ) => ( {
98
- fontSize : 13 ,
99
- color : theme . palette . text . secondary ,
100
- lineHeight : "1.6" ,
101
- display : "block" ,
102
- } ) }
103
- >
45
+ < span css = { styles . description } >
104
46
{ example . description } { " " }
105
47
< Link
106
48
component = { RouterLink }
@@ -112,16 +54,7 @@ export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
112
54
</ span >
113
55
</ div >
114
56
115
- < div
116
- css = { {
117
- display : "flex" ,
118
- gap : 12 ,
119
- flexDirection : "column" ,
120
- paddingTop : 24 ,
121
- marginTop : "auto" ,
122
- alignItems : "center" ,
123
- } }
124
- >
57
+ < div css = { styles . useButtonContainer } >
125
58
< Button
126
59
component = { RouterLink }
127
60
fullWidth
@@ -134,4 +67,66 @@ export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
134
67
) ;
135
68
} ;
136
69
137
- const styles = { } satisfies Record < string , Interpolation < Theme > > ;
70
+ const styles = {
71
+ card : ( theme ) => ( {
72
+ width : "320px" ,
73
+ padding : 24 ,
74
+ borderRadius : 6 ,
75
+ border : `1px solid ${ theme . palette . divider } ` ,
76
+ textAlign : "left" ,
77
+ textDecoration : "none" ,
78
+ color : "inherit" ,
79
+ display : "flex" ,
80
+ flexDirection : "column" ,
81
+ } ) ,
82
+
83
+ header : {
84
+ display : "flex" ,
85
+ alignItems : "center" ,
86
+ justifyContent : "space-between" ,
87
+ marginBottom : 24 ,
88
+ } ,
89
+
90
+ icon : {
91
+ flexShrink : 0 ,
92
+ paddingTop : 4 ,
93
+ width : 32 ,
94
+ height : 32 ,
95
+ } ,
96
+
97
+ tags : {
98
+ display : "flex" ,
99
+ flexWrap : "wrap" ,
100
+ gap : 8 ,
101
+ justifyContent : "end" ,
102
+ } ,
103
+
104
+ tag : ( theme ) => ( {
105
+ borderColor : theme . palette . divider ,
106
+ cursor : "pointer" ,
107
+ "&: hover" : {
108
+ borderColor : theme . palette . primary . main ,
109
+ } ,
110
+ } ) ,
111
+
112
+ activeTag : ( theme ) => ( {
113
+ borderColor : theme . experimental . roles . active . outline ,
114
+ backgroundColor : theme . experimental . roles . active . background ,
115
+ } ) ,
116
+
117
+ description : ( theme ) => ( {
118
+ fontSize : 13 ,
119
+ color : theme . palette . text . secondary ,
120
+ lineHeight : "1.6" ,
121
+ display : "block" ,
122
+ } ) ,
123
+
124
+ useButtonContainer : {
125
+ display : "flex" ,
126
+ gap : 12 ,
127
+ flexDirection : "column" ,
128
+ paddingTop : 24 ,
129
+ marginTop : "auto" ,
130
+ alignItems : "center" ,
131
+ } ,
132
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments