@@ -2,104 +2,129 @@ import classnames from 'classnames';
22
33/*
44
5- 1a👨🏻 💻 group the following together:
5+ 1a👨🏻💻 group the following together:
66
7- * image - imageAltText, imageUrlMobile, imageUrlTablet, imageUrlDesktop
8- * cta - ctaText, ctaUrl
9- * classNames - containerClassName, titleClassName, subTextClassName, ctaClassName, imageClassName
7+ * pokemon - pokemonName, pokemonType, pokemonHp, pokemonLevel
8+ * attack - attackName, attackDamage, attackDescription
9+ * image - imageAltText, imageUrlSmall, imageUrlMedium, imageUrlLarge
10+ * styling - cardClassName, nameClassName, typeClassName, hpClassName, attackClassName, imageClassName
1011
1112*/
12- interface IExerciseProps {
13- title : string ;
14- subText : string ;
15- ctaText : string ;
16- ctaUrl : string ;
13+ interface IPokemonCardProps {
14+ pokemonName : string ;
15+ pokemonType : string ;
16+ pokemonHp : number ;
17+ pokemonLevel : number ;
18+ attackName : string ;
19+ attackDamage : number ;
20+ attackDescription : string ;
1721 imageAltText : string ;
18- imageUrlMobile : string ;
19- imageUrlTablet : string ;
20- imageUrlDesktop : string ;
21- containerClassName ?: string ;
22- titleClassName ?: string ;
23- subTextClassName ?: string ;
24- ctaClassName ?: string ;
22+ imageUrlSmall : string ;
23+ imageUrlMedium : string ;
24+ imageUrlLarge : string ;
25+ cardClassName ?: string ;
26+ nameClassName ?: string ;
27+ typeClassName ?: string ;
28+ hpClassName ?: string ;
29+ attackClassName ?: string ;
2530 imageClassName ?: string ;
2631}
2732
2833/*
29- 1b👨🏻 💻 Update the props to match the new types defined above.
34+ 1b👨🏻💻 Update the props to match the new grouped types defined above.
3035*/
3136export const Exercise = ( {
32- title,
33- subText,
34- ctaText,
35- ctaUrl,
37+ pokemonName,
38+ pokemonType,
39+ pokemonHp,
40+ pokemonLevel,
41+ attackName,
42+ attackDamage,
43+ attackDescription,
3644 imageAltText,
37- imageUrlMobile,
38- imageUrlTablet,
39- imageUrlDesktop,
40- containerClassName,
41- titleClassName,
42- subTextClassName,
43- ctaClassName,
45+ imageUrlSmall,
46+ imageUrlMedium,
47+ imageUrlLarge,
48+ cardClassName,
49+ nameClassName,
50+ typeClassName,
51+ hpClassName,
52+ attackClassName,
4453 imageClassName
45- } : IExerciseProps ) => {
54+ } : IPokemonCardProps ) => {
4655 /*
47- 2a 🤔 Could we destructure the image to be [mobile, tablet, desktop ]?
56+ 2a 🤔 Could we destructure the image to be [small, medium, large ]?
4857 */
4958 /*
50- 1c👨🏻 💻 Update the props in the jsx
59+ 1c👨🏻💻 Update the props in the jsx to use the grouped structure
5160 */
5261 return (
5362 < article
5463 className = { classnames (
55- 'max-w-sm rounded overflow-hidden shadow-lg' ,
56- containerClassName
64+ 'max-w-sm rounded-lg overflow-hidden shadow-lg bg-gradient-to-b from-yellow-100 to-yellow-200 border-2 border-yellow-400 ' ,
65+ cardClassName
5766 ) }
5867 >
59- < picture >
60- { /* ✍🏻 picture elements are a great way to display responsive images */ }
61- { /* ✍🏻 Using rem instead of pixels will change the image when you zoom in the page */ }
62- { /* ✍🏻 Link: https://web.dev/learn/design/picture-element */ }
63- < source srcSet = { imageUrlDesktop } media = "(min-width: 62rem)" />
64- < source srcSet = { imageUrlTablet } media = "(min-width: 40rem)" />
65- < source srcSet = { imageUrlMobile } media = "(min-width: 32rem)" />
68+ < div className = "bg-blue-600 text-white p-2 text-center" >
69+ < span className = "text-xs font-bold" >
70+ ⭐ Level { pokemonLevel }
71+ </ span >
72+ </ div >
73+
74+ < picture className = "block p-4" >
75+ < source srcSet = { imageUrlLarge } media = "(min-width: 62rem)" />
76+ < source srcSet = { imageUrlMedium } media = "(min-width: 40rem)" />
77+ < source srcSet = { imageUrlSmall } media = "(min-width: 32rem)" />
6678 < img
67- src = { imageUrlDesktop }
79+ src = { imageUrlLarge }
6880 alt = { imageAltText }
6981 className = { classnames (
70- 'w-full object-cover h-full ' ,
82+ 'w-full h-48 object-contain rounded-lg ' ,
7183 imageClassName
7284 ) }
7385 />
7486 </ picture >
87+
7588 < div className = "px-6 py-4" >
7689 < h3
7790 className = { classnames (
78- 'font-bold text-xl mb-2' ,
79- titleClassName
91+ 'font-bold text-2xl mb-2 text-center ' ,
92+ nameClassName
8093 ) }
8194 >
82- { title }
95+ { pokemonName }
8396 </ h3 >
84- < p
85- className = { classnames (
86- 'text-gray-700 text-base' ,
87- subTextClassName
88- ) }
89- >
90- { subText }
91- </ p >
92- </ div >
93- < div className = "px-6 pt-4 pb-2" >
94- < a
95- href = { ctaUrl }
97+
98+ < div className = "flex justify-between items-center mb-4" >
99+ < span
100+ className = { classnames (
101+ 'inline-block bg-blue-500 text-white rounded-full px-3 py-1 text-sm font-semibold' ,
102+ typeClassName
103+ ) }
104+ >
105+ { pokemonType } Type
106+ </ span >
107+ < span
108+ className = { classnames (
109+ 'text-red-600 font-bold text-lg' ,
110+ hpClassName
111+ ) }
112+ >
113+ ❤️ { pokemonHp } HP
114+ </ span >
115+ </ div >
116+
117+ < div
96118 className = { classnames (
97- 'inline-block bg-gray-200 hover:bg-gray-300 transition-colors rounded-full px -3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2 ' ,
98- ctaClassName
119+ 'bg-gray-100 rounded-lg p -3 border-l-4 border-orange-400 ' ,
120+ attackClassName
99121 ) }
100122 >
101- { ctaText }
102- </ a >
123+ < h4 className = "font-bold text-orange-600 mb-1" >
124+ ⚡ { attackName } - { attackDamage } damage
125+ </ h4 >
126+ < p className = "text-gray-700 text-sm" > { attackDescription } </ p >
127+ </ div >
103128 </ div >
104129 </ article >
105130 ) ;
0 commit comments