File tree Expand file tree Collapse file tree 2 files changed +30
-13
lines changed
Expand file tree Collapse file tree 2 files changed +30
-13
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,12 @@ const AgendaHeader = () => {
2727 </ ul >
2828 </ Card >
2929 < div className = "flex md:flex-row flex-col gap-10 justify-center items-center md:items-baseline text-primary-500 mt-[72px]" >
30- < AgendaItem time = { '9:00 AM - 3:00 PM' } title = { 'Registro' } icon = { IdCardLanyard } />
31- < AgendaItem time = { '9:30am - 11:00am' } title = { 'Coffee break' } icon = { Coffee } />
32- < AgendaItem time = { '10:15 AM - 2:00 PM y 3:55 PM - 7:00 PM' } title = { 'Charlas' } icon = { Megaphone } />
33- < AgendaItem time = { '2:05 PM - 3:55 PM' } title = { 'Comida' } icon = { HandPlatter } />
34- < AgendaItem time = { '7:00 PM - 9:00 PM' } title = { 'Networking' } icon = { CandyCane } />
35- < AgendaItem time = { '7:00 PM - 9:00 PM' } title = { 'Clausura' } icon = { Beer } />
30+ < AgendaItem time = { [ '9:00 AM - 3:00 PM' ] } title = { 'Registro' } icon = { IdCardLanyard } />
31+ < AgendaItem time = { [ '9:30am - 11:00am' ] } title = { 'Coffee break' } icon = { Coffee } />
32+ < AgendaItem time = { [ '10:15 AM - 2:00 PM' , ' 3:55 PM - 7:00 PM'] } title = { 'Charlas' } icon = { Megaphone } />
33+ < AgendaItem time = { [ '2:05 PM - 3:55 PM' ] } title = { 'Comida' } icon = { HandPlatter } />
34+ < AgendaItem time = { [ '7:00 PM - 9:00 PM' ] } title = { 'Networking' } icon = { CandyCane } />
35+ < AgendaItem time = { [ '7:00 PM - 9:00 PM' ] } title = { 'Clausura' } icon = { Beer } />
3636 </ div >
3737 </ aside >
3838 </ >
Original file line number Diff line number Diff line change 1- const AgendaItem = ( { icon : Icon , title, time } ) => {
2- const [ start , end ] = time . split ( " - " ) ;
1+ import React from "react" ;
2+
3+ interface AgendaItemProps {
4+ icon : React . ComponentType < React . SVGProps < SVGSVGElement > > ;
5+ title : string ;
6+ time : Array < string > ;
7+ }
8+
9+ const AgendaItem : React . FC < AgendaItemProps > = ( { icon : Icon , title, time } ) => {
10+
11+ const splitTime = ( timeString : string ) => {
12+ const [ start , end ] = timeString . split ( " - " ) ;
13+ return { start, end } ;
14+ }
15+ const isSingleTime = time . length === 1 ;
316
417 return (
518 < aside className = "flex flex-col items-center text-center gap-2 w-[180px] hover:scale-105 transition-transform" >
619 < span className = "h-14 w-14 border-2 border-primary-500 flex items-center justify-center" >
720 { Icon && < Icon className = "h-6 w-6 text-primary-500" /> }
821 </ span >
922 < p className = "font-medium text-primary-800" > { title } </ p >
10- < time className = "flex flex-col items-center text-primary-600 text-sm leading-tight" >
11- < span > { start } </ span >
12- { end && < span className = "text-xs" > -</ span > }
13- < span > { end } </ span >
14- </ time >
23+ {
24+ time . map ( ( timeString , index ) => (
25+ < time key = { `time-${ index } ` } className = { `flex ${ isSingleTime ? "flex-col" : "flex-row flex-wrap gap-2" } items-center text-primary-600 text-sm leading-tight` } >
26+ < span > { splitTime ( timeString ) . start } </ span >
27+ { splitTime ( timeString ) . end && < span className = "text-xs" > -</ span > }
28+ < span > { splitTime ( timeString ) . end } </ span >
29+ </ time >
30+ ) )
31+ }
1532 </ aside >
1633 )
1734}
You can’t perform that action at this time.
0 commit comments