11import React , { useState } from 'react' ;
22import styled from 'styled-components' ;
33import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
4- import { faFlag , faMapMarkerAlt , faCalendarAlt , faShareAlt } from '@fortawesome/free-solid-svg-icons' ;
4+ import { faFlag , faSignal , faClock , faShareAlt } from '@fortawesome/free-solid-svg-icons' ;
55
66const shareContent = ( url , organizer , title ) => {
77 if ( navigator . share ) {
@@ -20,20 +20,21 @@ const shareContent = (url, organizer, title) => {
2020
2121// List of Global Tech Bootcamps
2222
23- const Bootcamps = [
23+ const bootcamp = [
2424 {
25- organizer : 'Organizer Name' ,
26- title : 'Event Name' ,
27- location : 'Event Location' ,
28- date : 'Event Date' ,
29- domains : [ 'Open Innovation' , 'No Restrictions' ] ,
30- applyLink : '#' ,
31- poster : '/assets/Coming Soon.png' ,
32- shareLink : '#comingsoon' ,
25+ organizer : 'Freecodecamp' ,
26+ title : 'JavaScript Algorithms and DS' ,
27+ duration : '4 Weeks' ,
28+ level : 'Intermediate' ,
29+ skills : [ 'JavaScript' , 'Algorithms' , 'Data Structures' ] ,
30+ referralCode : 'devdisplay' ,
31+ ApplyLink : 'https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/' ,
32+ poster : '/assets/Certifications/JavaScript Algorithms and DS.png' ,
33+ shareLink : '#javascript-algorithms-ds' ,
3334 } ,
3435] ;
3536
36- const StyledbootcampsCard = styled . div `
37+ const StyledbootcampCard = styled . div `
3738 position: relative;
3839 border: 1px solid rgb(182, 228, 250);
3940 background: linear-gradient(to right, rgba(15, 27, 53, 0.44), rgba(0, 43, 62, 0.43));
@@ -109,30 +110,39 @@ const StyledbootcampsCard = styled.div`
109110 }
110111` ;
111112
112- const BootcampsCardComponent = ( { organizer, title, location, date, domains, applyLink, poster, shareLink } ) => {
113+ const BootcampCardComponent = ( {
114+ organizer,
115+ title,
116+ duration,
117+ level,
118+ skills,
119+ referralCode,
120+ ApplyLink,
121+ poster,
122+ shareLink,
123+ } ) => {
113124 return (
114- < StyledbootcampsCard id = { shareLink . substring ( 1 ) } >
115- { /* <div className="dot"></div> */ }
125+ < StyledbootcampCard id = { shareLink . substring ( 1 ) } >
116126 < div className = "flex items-center justify-between p-2" >
117127 < span className = "text-sm font-semibold text-white" >
118128 < FontAwesomeIcon icon = { faFlag } className = "mr-1 text-[#00a6fb]" /> { organizer }
119129 </ span >
120130 < a
121- href = { applyLink }
131+ href = { ApplyLink }
122132 target = "_blank"
123133 rel = "noopener noreferrer"
124- className = "bg-gray-1000 hover:bg-gray-1000 text-semibold relative flex items-center rounded-full border border-[#00a6fb] px-2 py-1 text-gray-300"
134+ className = "bg-gray-1000 hover:bg-gray-1000 text-semibold flex items-center rounded-full border border-[#00a6fb] px-2 py-1 text-gray-300"
125135 >
126- < div className = "status-user" style = { { marginRight : '8px' } } />
127- Apply Now
136+ < div className = "status-user mr-2" />
137+ Applu Now
128138 </ a >
129139 </ div >
130140
131141 < div className = "h-50 relative w-full overflow-hidden rounded-xl p-2 shadow-md" >
132142 < div className = "absolute bottom-3 right-3 z-10" >
133143 < button
134144 onClick = { ( ) => shareContent ( window . location . href . split ( '#' ) [ 0 ] + shareLink ) }
135- className = "bg-gray-1000 hover:bg-slate-1000 flex items-center justify-center gap-2 rounded-xl border border-[#00a6fb] bg-opacity-50 px-2 py-1 text-xs text-white backdrop-blur-md transition-colors "
145+ className = "bg-gray-1000 hover:bg-slate-1000 flex items-center justify-center gap-2 rounded-xl border border-[#00a6fb] bg-opacity-50 px-2 py-1 text-xs text-white backdrop-blur-md"
136146 >
137147 < FontAwesomeIcon icon = { faShareAlt } />
138148 Share
@@ -144,7 +154,7 @@ const BootcampsCardComponent = ({ organizer, title, location, date, domains, app
144154 className = "h-full w-full rounded-lg object-cover"
145155 onError = { ( e ) => {
146156 e . target . onerror = null ;
147- e . target . src = '/images/default .png' ;
157+ e . target . src = '/assets/Coming Soon .png' ;
148158 } }
149159 />
150160 </ div >
@@ -153,24 +163,23 @@ const BootcampsCardComponent = ({ organizer, title, location, date, domains, app
153163
154164 < div className = "flex justify-between p-2 text-sm text-[#00a6fb]" >
155165 < span >
156- < FontAwesomeIcon icon = { faMapMarkerAlt } className = "mr-1 text-white" /> { location }
166+ < FontAwesomeIcon icon = { faClock } className = "mr-1 text-white" /> { duration }
157167 </ span >
158168 < span >
159- < FontAwesomeIcon icon = { faCalendarAlt } className = "mr-1 text-white" /> { date }
169+ < FontAwesomeIcon icon = { faSignal } className = "mr-1 text-white" /> { level }
160170 </ span >
161171 </ div >
162172
173+ < div className = "mb-1 text-center text-sm text-gray-400" > Referral Code: { referralCode } </ div >
174+
163175 < div className = "mt-2 flex flex-wrap justify-center gap-2 p-2" >
164- { domains . map ( ( domain , idx ) => (
165- < span
166- key = { idx }
167- className = "bg-gray-1000 rounded-full border border-[#00a6fb] px-2 py-1 text-xs text-gray-300"
168- >
169- { domain }
176+ { skills . map ( ( skill , idx ) => (
177+ < span key = { idx } className = "bg-gray-1000 rounded-full border border-[#00a6fb] px-2 py-1 text-xs text-gray-300" >
178+ { skill }
170179 </ span >
171180 ) ) }
172181 </ div >
173- </ StyledbootcampsCard >
182+ </ StyledbootcampCard >
174183 ) ;
175184} ;
176185
@@ -184,14 +193,14 @@ const BootcampsCardComponent = ({ organizer, title, location, date, domains, app
184193 font-weight: normal;
185194 font-style: normal;
186195 }
187- ` }
196+ ` }
188197</ style > ;
189198
190- const StyledbootcampsListContainer = styled . div `
199+ const StyledbootcampListContainer = styled . div `
191200 display: flex;
192201 flex-wrap: wrap;
193202 justify-content: center;
194- gap: 0.5rem; /* Decreased gap */
203+ gap: 0.5rem;
195204 padding: 1rem;
196205
197206 @media (min-width: 768px) {
@@ -242,59 +251,40 @@ const FilterContainer = styled.div`
242251` ;
243252
244253const BootcampsList = ( ) => {
245- const [ locationFilter , setLocationFilter ] = useState ( '' ) ;
246- const [ monthFilter , setMonthFilter ] = useState ( '' ) ;
247- const [ domainFilter , setDomainFilter ] = useState ( '' ) ;
254+ const [ skillFilter , setSkillFilter ] = useState ( '' ) ;
255+ const [ organizerFilter , setOrganizerFilter ] = useState ( '' ) ;
248256
249- const filteredbootcamps = Bootcamps . filter ( ( bootcamps ) => {
250- const matchesLocation = locationFilter
251- ? bootcamps . location . toLowerCase ( ) . includes ( locationFilter . toLowerCase ( ) )
252- : true ;
253- const matchesMonth = monthFilter
254- ? new Date ( bootcamps . date . split ( ' - ' ) [ 0 ] ) . getMonth ( ) + 1 === parseInt ( monthFilter )
257+ const filteredbootcamp = bootcamp . filter ( ( bootcamp ) => {
258+ const matchesSkill = skillFilter
259+ ? bootcamp . skills . some ( ( skill ) => skill . toLowerCase ( ) . includes ( skillFilter . toLowerCase ( ) ) )
255260 : true ;
256- const matchesDomain = domainFilter
257- ? bootcamps . domains . some ( ( domain ) => domain . toLowerCase ( ) . includes ( domainFilter . toLowerCase ( ) ) )
261+ const matchesOrganizer = organizerFilter
262+ ? bootcamp . organizer . toLowerCase ( ) . includes ( organizerFilter . toLowerCase ( ) )
258263 : true ;
259- return matchesLocation && matchesMonth && matchesDomain ;
264+ return matchesSkill && matchesOrganizer ;
260265 } ) ;
261266
262267 return (
263268 < >
264269 < FilterContainer >
265270 < input
266271 type = "text"
267- placeholder = "Search by location "
268- value = { locationFilter }
269- onChange = { ( e ) => setLocationFilter ( e . target . value ) }
272+ placeholder = "Search by domain or skills "
273+ value = { skillFilter }
274+ onChange = { ( e ) => setSkillFilter ( e . target . value ) }
270275 />
271- < select value = { monthFilter } onChange = { ( e ) => setMonthFilter ( e . target . value ) } >
272- < option value = "" > Select month</ option >
273- < option value = "1" > January</ option >
274- < option value = "2" > February</ option >
275- < option value = "3" > March</ option >
276- < option value = "4" > April</ option >
277- < option value = "5" > May</ option >
278- < option value = "6" > June</ option >
279- < option value = "7" > July</ option >
280- < option value = "8" > August</ option >
281- < option value = "9" > September</ option >
282- < option value = "10" > October</ option >
283- < option value = "11" > November</ option >
284- < option value = "12" > December</ option >
285- </ select >
286276 < input
287277 type = "text"
288- placeholder = "Search by domain "
289- value = { domainFilter }
290- onChange = { ( e ) => setDomainFilter ( e . target . value ) }
278+ placeholder = "Search by organizer "
279+ value = { organizerFilter }
280+ onChange = { ( e ) => setOrganizerFilter ( e . target . value ) }
291281 />
292282 </ FilterContainer >
293- < StyledbootcampsListContainer >
294- { filteredbootcamps . map ( ( bootcamps , idx ) => (
295- < BootcampsCardComponent key = { idx } { ...bootcamps } />
283+ < StyledbootcampListContainer >
284+ { filteredbootcamp . map ( ( bootcamp , idx ) => (
285+ < BootcampCardComponent key = { idx } { ...bootcamp } />
296286 ) ) }
297- </ StyledbootcampsListContainer >
287+ </ StyledbootcampListContainer >
298288 </ >
299289 ) ;
300290} ;
0 commit comments