Skip to content

Commit

Permalink
🎨 Card styles have been improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Alcaras committed Nov 26, 2023
1 parent da18d7c commit ab8eeaf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
21 changes: 16 additions & 5 deletions src/components/Card.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
.card {
border: 1px solid black;
margin: 2rem;
padding: 2rem;
display: inline-block;
}
border-radius: 0.5rem;
margin: 1rem;
padding: 1rem;
display: inline-block;
width: 140px;
box-shadow: 0 0 1rem rgba(0, 0, 0, 0.4);
user-select: none;
img {
width: 100%;
}
span {
display: block;
text-align: center;
margin-top: 0.5rem;
}
}
21 changes: 9 additions & 12 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,21 @@ export const Card: React.FC<CardProps> = ({ name, flipped, onClick }) => {
}, [setPokemon, name]);

return (
<div
className="card"
style={{
backgroundColor: flipped ? "cyan" : "gray",
minWidth: "50px",
minHeight: "80px",
}}
onClick={onClick}
>
<div className="card" onClick={onClick}>
<img
onLoad={() => console.log(false)}
src={pokemon?.sprites.other["official-artwork"].front_default}
alt={pokemon?.name}
width="60"
style={{
display: flipped ? "block" : "none",
visibility: flipped ? "visible" : "hidden",
}}
/>
<span
style={{
visibility: flipped ? "visible" : "hidden",
}}
>
{pokemon?.name ?? name}
</span>
</div>
);
};

0 comments on commit ab8eeaf

Please sign in to comment.