File tree Expand file tree Collapse file tree 3 files changed +29
-11
lines changed
Expand file tree Collapse file tree 3 files changed +29
-11
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import CatFromAxios from '../Interfaces/CatFromAxios' ;
33import Card from './Styling/Card' ;
4+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
5+ import { faPenToSquare } from '@fortawesome/free-solid-svg-icons' ;
46
57interface Props {
68 cat : CatFromAxios ;
9+ setSelectedCat : React . Dispatch < React . SetStateAction < CatFromAxios | null > > ;
710}
811
9- export default function CatCard ( { cat } : Props ) {
12+ export default function CatCard ( { cat, setSelectedCat } : Props ) {
1013 return (
1114 < Card heading = { cat . name } >
12- < div className = "flex justify-between" >
13- < img src = { cat . picture_url ?? '' } alt = { cat . name } className = "w-20" />
15+ < div className = "flex justify-between h-10 sm:h-16" >
16+ < img
17+ src = { cat . picture_url ?? '' }
18+ alt = { cat . name }
19+ className = "w-10 h-10 sm:w-16 sm:h-16"
20+ />
1421 < div >
1522 < p > Level: { cat . battle_profile . level . toString ( ) } </ p >
1623 < p > XP: { cat . battle_profile . xp . toString ( ) } </ p >
1724 </ div >
1825 < p > { cat . description ?? 'A good kitty' } </ p >
26+ < FontAwesomeIcon
27+ className = "h-full"
28+ icon = { faPenToSquare }
29+ onClick = { ( ) => {
30+ setSelectedCat ( cat ) ;
31+ } }
32+ />
1933 </ div >
2034 </ Card >
2135 ) ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import CatCard from './CatCard';
1010export default function MyClowder ( ) {
1111 const { userId } = useContext ( UserContext ) ;
1212 const [ myCats , setMyCats ] = useState < CatFromAxios [ ] > ( [ ] ) ;
13+ const [ selectedCat , setSelectedCat ] = useState < CatFromAxios | null > ( null ) ;
1314
1415 useEffect ( ( ) => {
1516 if ( userId ) {
@@ -21,21 +22,20 @@ export default function MyClowder() {
2122 }
2223 } , [ userId ] ) ;
2324
24- return (
25+ return selectedCat ? (
26+ < ModalPopover >
27+ < CatProfile />
28+ </ ModalPopover >
29+ ) : (
2530 < >
2631 < H2 > My Clowder</ H2 >
2732 < ul >
2833 { myCats . map ( ( cat ) => (
2934 < li key = { cat . id } >
30- < CatCard cat = { cat } > </ CatCard >
35+ < CatCard cat = { cat } setSelectedCat = { setSelectedCat } / >
3136 </ li >
3237 ) ) }
3338 </ ul >
34- { false && (
35- < ModalPopover >
36- < CatProfile > </ CatProfile >
37- </ ModalPopover >
38- ) }
3939 </ >
4040 ) ;
4141}
Original file line number Diff line number Diff line change @@ -5,5 +5,9 @@ interface Props {
55}
66
77export default function H3 ( { children } : Props ) {
8- return < h3 className = "text-2xl font-bold mb-5" > { children } </ h3 > ;
8+ return (
9+ < h3 className = "text-xl sm:text-2xl lg:text-3xl xl:text-4xl font-bold mb-5" >
10+ { children }
11+ </ h3 >
12+ ) ;
913}
You can’t perform that action at this time.
0 commit comments