@@ -8,7 +8,7 @@ interface IProps {
88
99export const DayCard : React . FC < IProps > = ( props : IProps ) : React . ReactElement | null => {
1010 const [ flip , setFlip ] = useState ( false ) ;
11-
11+
1212 function readableDate ( date : string ) : string {
1313 return DateTime . fromISO ( date ) . toFormat ( 'dd LLLL yyyy' ) ;
1414 }
@@ -22,50 +22,54 @@ export const DayCard: React.FC<IProps> = (props: IProps): React.ReactElement | n
2222 }
2323
2424 return (
25- < div className = "flex flex-col mt-[30px] m-8" onClick = { toggleFlip } >
26- { flip ? (
27- // Back of the card
28- < div className = "p-4 border border-white border-opacity-30 cursor-pointer hover:scale-105 transform-3d perspective-[1000px] rotate-y-12" >
29- < p className = "font-ibm text-white opacity-75 text-[10px] text-justify" >
30- { props . dayPicture . explanation }
31- </ p >
32- </ div >
33- ) : (
34- // Front of the card
35- props . dayPicture . media_type === 'image' ? (
36- < div
37- className = "h-90 bg-cover bg-center cursor-pointer"
38- style = { { backgroundImage : `url(${ props . dayPicture . url } )` } }
39- />
40- ) : (
41- < a
42- target = "_blank"
43- rel = "noopener noreferrer"
44- href = { props . dayPicture . url }
45- onClick = { ( e ) => e . stopPropagation ( ) }
46- className = "flex items-center justify-center font-ibm h-90 text-white cursor-pointer p-4 border border-white border-opacity-30"
47- >
48- This is a { props . dayPicture . media_type } . Follow link ...
49- </ a >
50- )
51- ) }
25+ < div className = "text-theme" >
26+ < div className = "flex flex-col mt-8 m-2" >
27+ < div className = "h-90 w-90 perspective-1000 cursor-pointer" onClick = { toggleFlip } >
28+ < div
29+ className = { `relative h-90 transition-transform duration-1000 [transform-style:preserve-3d] ${
30+ flip ? '[transform:rotateY(180deg)]' : ''
31+ } `}
32+ >
33+ { /* Front */ }
34+ { props . dayPicture . media_type === 'image' ? (
35+ < div className = "absolute inset-0 [backface-visibility:hidden]" >
36+ < img className = "object-cover h-90 w-full" src = { props . dayPicture . url } alt = "NASA Pic" />
37+ </ div >
38+ ) : (
39+ < a
40+ target = "_blank"
41+ rel = "noopener noreferrer"
42+ href = { props . dayPicture . url }
43+ onClick = { ( e ) => e . stopPropagation ( ) }
44+ className = "block h-90 w-full backface-hidden"
45+ >
46+ < p className = "text-theme font-ibm border border-theme p-4 h-full w-full text-center flex items-center justify-center text-base" >
47+ This is a { props . dayPicture . media_type } . Follow link...
48+ </ p >
49+ </ a >
50+ ) }
5251
53- { /* Info Container (always visible) */ }
54- < div className = "bg-accent mt-[16px]" >
55- < div className = "p-[12px]" >
56- < p className = "font-ibm text-dark font-normal text-[16px]" >
57- { readableDate ( props . dayPicture . date ) }
58- </ p >
59- < p className = "font-ibm text-light font-bold text-[16px] mt-[3px]" >
60- { props . dayPicture . title }
61- </ p >
62- { ! ! props . dayPicture . copyright && (
63- < p className = "font-ibm text-white opacity-75 text-[8px] mt-[5px]" >
64- IMAGE CREDIT: { props . dayPicture . copyright }
65- </ p >
66- ) }
52+ { /* Back */ }
53+ < div className = "absolute inset-0 p-4 border border-theme h-90 w-full [transform:rotateY(180deg)] [backface-visibility:hidden]" >
54+ < p className = "font-ibm text-theme opacity-75 text-[9px] text-justify font-medium" >
55+ { props . dayPicture . explanation }
56+ </ p >
57+ </ div >
58+ </ div >
59+ </ div >
60+
61+ { /* Info Container */ }
62+ < div className = "bg-accent mt-4" >
63+ < div className = "p-3" >
64+ < p className = "font-ibm text-text-dark font-normal text-base" > { readableDate ( props . dayPicture . date ) } </ p >
65+ < p className = "font-ibm text-text-light font-bold text-base mt-1" > { props . dayPicture . title } </ p >
66+ { ! ! props . dayPicture . copyright && (
67+ < p className = "font-ibm text-white opacity-75 text-xs mt-1" > IMAGE CREDIT: { props . dayPicture . copyright } </ p >
68+ ) }
69+ </ div >
70+ </ div >
71+ </ div >
6772 </ div >
68- </ div >
69- </ div >
7073 ) ;
71- } ;
74+ } ;
75+
0 commit comments