@@ -46,6 +46,7 @@ function Container({ course, courses, borderRadius, children, ...rest }) {
46
46
47
47
function MktSideRecommendedCourses ( { title, endpoint, technologies, containerPadding, ...rest } ) {
48
48
const { t, lang } = useTranslation ( 'common' ) ;
49
+ const { hexColor } = useStyle ( ) ;
49
50
const [ isLoading , setIsLoading ] = useState ( true ) ;
50
51
const BREATHECODE_HOST = modifyEnv ( { queryString : 'host' , env : process . env . BREATHECODE_HOST } ) ;
51
52
const [ courses , setCourses ] = useState ( [ ] ) ;
@@ -94,73 +95,121 @@ function MktSideRecommendedCourses({ title, endpoint, technologies, containerPad
94
95
} , [ ] ) ;
95
96
96
97
return courses ?. length > 0 && (
97
- < Box as = "aside" minWidth = { { base : '100%' , md : '214px' } } width = "auto" margin = "0 auto" { ...rest } >
98
- { title && (
99
- < Heading size = "18px" lineHeight = "21px" m = "10px 0 20px 0" >
100
- { title || t ( 'continue-learning-course' ) }
101
- </ Heading >
102
- ) }
103
- { ! isLoading && courses ?. length > 0 ? (
104
- < Box display = "flex" flexDirection = { { base : 'row' , md : 'column' } } overflow = "auto" gridGap = "14px" >
105
- { courses . map ( ( course ) => {
106
- const courseLink = course ?. course_translation ?. landing_url ;
107
- const link = courseLink || `${ ORIGIN_HOST } ${ langConnector } /${ course ?. slug } ` ;
108
- // const tags = course?.technologies?.length > 0 && typeof course?.technologies === 'string'
109
- // ? course?.technologies?.split(',').map((tag) => toCapitalize(tag?.trim()))
110
- // : [];
111
- const tags = [ ] ;
112
- // const tags = ['Free course'];
113
-
114
- return (
115
- < Container border = "1px solid" borderColor = { { base : 'default' , md : 'success' } } key = { course ?. slug } course = { course } courses = { courses } borderRadius = { rest . borderRadius } padding = { containerPadding } >
116
- < TagCapsule tags = { tags } background = "green.light" color = "green.500" fontWeight = { 700 } fontSize = "13px" marginY = "0" paddingX = "0" variant = "rounded" gap = "10px" display = { { base : 'none' , md : 'inherit' } } />
117
- < Box display = "flex" flexDirection = { { base : 'column' , md : 'row' } } gridGap = "8px" >
118
- < TagCapsule tags = { tags } background = "green.light" color = "green.500" fontWeight = { 700 } fontSize = "13px" marginY = "0" paddingX = "0" variant = "rounded" gap = "10px" display = { { base : 'inherit' , md : 'none' } } />
119
-
120
- < Image display = { { base : 'none' , md : 'inherit' } } src = { course ?. icon_url } width = "46px" height = "46px" borderRadius = "8px" background = "green.400" />
121
- < Heading size = "18px" >
122
- { course ?. course_translation ?. title }
123
- </ Heading >
98
+ < >
99
+ < Box color = "white" zIndex = "10" borderRadius = "11px 11px 0 0" background = { hexColor . greenLight } padding = "10px 20px" bottom = "0" position = "sticky" marginBottom = "20px" display = { { base : 'block' , md : 'none' } } textAlign = "left" >
100
+ { courses . map ( ( course ) => {
101
+ const courseLink = course ?. course_translation ?. landing_url ;
102
+ const link = courseLink || `${ ORIGIN_HOST } ${ langConnector } /${ course ?. slug } ` ;
103
+
104
+ return (
105
+ < >
106
+ < Box display = "flex" alignItems = "center" gap = "10px" >
107
+ < Image src = { course ?. icon_url } width = "46px" height = "46px" borderRadius = "8px" background = "green.400" />
108
+ < Heading size = "18px" >
109
+ { course ?. course_translation ?. title }
110
+ </ Heading >
111
+ </ Box >
112
+ < Link
113
+ variant = "buttonDefault"
114
+ onClick = { ( ) => {
115
+ setStorageItem ( 'redirected-from' , link ) ;
116
+ reportDatalayer ( {
117
+ dataLayer : {
118
+ event : 'ad_interaction' ,
119
+ course_slug : course . slug ,
120
+ course_title : course . title ,
121
+ ad_position : 'top-left' ,
122
+ ad_type : 'course' ,
123
+ } ,
124
+ } ) ;
125
+ } }
126
+ href = { `${ link } ?internal_cta_placement=mktsiderecommendedcourses&internal_cta_content=${ course ?. slug } &internal_cta_campaign=null` }
127
+ alignItems = "center"
128
+ display = "flex"
129
+ justifyContent = "center"
130
+ colorScheme = "success"
131
+ color = "success"
132
+ background = "white"
133
+ gridGap = "10px"
134
+ width = "100%"
135
+ >
136
+ < Box as = "span" display = "flex" >
137
+ { t ( 'learn-more' ) }
124
138
</ Box >
125
- < Text display = { { base : 'none' , md : 'inherit' } } fontSize = "12px" lineHeight = "14px" padding = "0 20px" >
126
- { course ?. course_translation ?. short_description || course ?. course_translation ?. description }
127
- </ Text >
128
- < Link
129
- variant = { { base : '' , md : 'buttonDefault' } }
130
- onClick = { ( ) => {
131
- setStorageItem ( 'redirected-from' , link ) ;
132
- reportDatalayer ( {
133
- dataLayer : {
134
- event : 'ad_interaction' ,
135
- course_slug : course . slug ,
136
- course_title : course . title ,
137
- ad_position : 'top-left' ,
138
- ad_type : 'course' ,
139
- } ,
140
- } ) ;
141
- } }
142
- href = { `${ link } ?internal_cta_placement=mktsiderecommendedcourses&internal_cta_content=${ course ?. slug } &internal_cta_campaign=null` }
143
- alignItems = "center"
144
- display = "flex"
145
- colorScheme = { { base : 'default' , md : 'success' } }
146
- width = "auto"
147
- color = { { base : 'green.light' , md : 'white' } }
148
- gridGap = "10px"
149
- margin = "0 20px"
150
- >
151
- < Box as = "span" display = { { base : 'none' , md : 'flex' } } >
152
- { t ( 'learn-more' ) }
139
+ < Icon icon = "longArrowRight" width = "24px" height = "10px" color = "currentColor" />
140
+ </ Link >
141
+ </ >
142
+ ) ;
143
+ } ) }
144
+ </ Box >
145
+ < Box display = { { base : 'none' , md : 'block' } } as = "aside" minWidth = { { base : '100%' , md : '214px' } } width = "auto" margin = "0 auto" { ...rest } >
146
+ { title && (
147
+ < Heading size = "18px" lineHeight = "21px" m = "10px 0 20px 0" >
148
+ { title || t ( 'continue-learning-course' ) }
149
+ </ Heading >
150
+ ) }
151
+ { ! isLoading && courses ?. length > 0 ? (
152
+ < Box display = "flex" flexDirection = { { base : 'row' , md : 'column' } } overflow = "auto" gridGap = "14px" >
153
+ { courses . map ( ( course ) => {
154
+ const courseLink = course ?. course_translation ?. landing_url ;
155
+ const link = courseLink || `${ ORIGIN_HOST } ${ langConnector } /${ course ?. slug } ` ;
156
+ // const tags = course?.technologies?.length > 0 && typeof course?.technologies === 'string'
157
+ // ? course?.technologies?.split(',').map((tag) => toCapitalize(tag?.trim()))
158
+ // : [];
159
+ const tags = [ ] ;
160
+ // const tags = ['Free course'];
161
+
162
+ return (
163
+ < Container border = "1px solid" borderColor = { { base : 'default' , md : 'success' } } key = { course ?. slug } course = { course } courses = { courses } borderRadius = { rest . borderRadius } padding = { containerPadding } >
164
+ < TagCapsule tags = { tags } background = "green.light" color = "green.500" fontWeight = { 700 } fontSize = "13px" marginY = "0" paddingX = "0" variant = "rounded" gap = "10px" display = { { base : 'none' , md : 'inherit' } } />
165
+ < Box display = "flex" flexDirection = { { base : 'column' , md : 'row' } } gridGap = "8px" >
166
+ < TagCapsule tags = { tags } background = "green.light" color = "green.500" fontWeight = { 700 } fontSize = "13px" marginY = "0" paddingX = "0" variant = "rounded" gap = "10px" display = { { base : 'inherit' , md : 'none' } } />
167
+
168
+ < Image display = { { base : 'none' , md : 'inherit' } } src = { course ?. icon_url } width = "46px" height = "46px" borderRadius = "8px" background = "green.400" />
169
+ < Heading size = "18px" >
170
+ { course ?. course_translation ?. title }
171
+ </ Heading >
153
172
</ Box >
154
- < Icon icon = "longArrowRight" width = "24px" height = "10px" color = "currentColor" />
155
- </ Link >
156
- </ Container >
157
- ) ;
158
- } ) }
159
- </ Box >
160
- ) : (
161
- < CardSkeleton withoutContainer quantity = { 1 } height = { rest . skeletonHeight } borderRadius = { rest . skeletonBorderRadius } />
162
- ) }
163
- </ Box >
173
+ < Text display = { { base : 'none' , md : 'inherit' } } fontSize = "12px" lineHeight = "14px" padding = "0 20px" >
174
+ { course ?. course_translation ?. short_description || course ?. course_translation ?. description }
175
+ </ Text >
176
+ < Link
177
+ variant = { { base : '' , md : 'buttonDefault' } }
178
+ onClick = { ( ) => {
179
+ setStorageItem ( 'redirected-from' , link ) ;
180
+ reportDatalayer ( {
181
+ dataLayer : {
182
+ event : 'ad_interaction' ,
183
+ course_slug : course . slug ,
184
+ course_title : course . title ,
185
+ ad_position : 'top-left' ,
186
+ ad_type : 'course' ,
187
+ } ,
188
+ } ) ;
189
+ } }
190
+ href = { `${ link } ?internal_cta_placement=mktsiderecommendedcourses&internal_cta_content=${ course ?. slug } &internal_cta_campaign=null` }
191
+ alignItems = "center"
192
+ display = "flex"
193
+ colorScheme = { { base : 'default' , md : 'success' } }
194
+ width = "auto"
195
+ color = { { base : 'green.light' , md : 'white' } }
196
+ gridGap = "10px"
197
+ margin = "0 20px"
198
+ >
199
+ < Box as = "span" display = { { base : 'none' , md : 'flex' } } >
200
+ { t ( 'learn-more' ) }
201
+ </ Box >
202
+ < Icon icon = "longArrowRight" width = "24px" height = "10px" color = "currentColor" />
203
+ </ Link >
204
+ </ Container >
205
+ ) ;
206
+ } ) }
207
+ </ Box >
208
+ ) : (
209
+ < CardSkeleton withoutContainer quantity = { 1 } height = { rest . skeletonHeight } borderRadius = { rest . skeletonBorderRadius } />
210
+ ) }
211
+ </ Box >
212
+ </ >
164
213
) ;
165
214
}
166
215
0 commit comments