Skip to content

Commit

Permalink
added hover image
Browse files Browse the repository at this point in the history
  • Loading branch information
alexartemov7 committed Oct 31, 2023
2 parents 201d535 + a017295 commit 499b3f6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#2C2560",
"titleBar.activeBackground": "#3E3386",
"titleBar.activeForeground": "#FBFBFD"
}
}
17 changes: 16 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
body {
background-color: #402010;
background-color: #402090;
color: antiquewhite;
padding: 2em;
}
Expand Down Expand Up @@ -30,11 +30,21 @@ main {
border-radius: 8px;
margin: 0.5em;
width: 260px;
cursor: pointer;
}

.selected {
border: 1px solid #ff00d0;
}

.beer-image {
width: 100%;
max-height: 500px;
transition: 0.3s;
}

.beer-image:hover{
transform: scale(1.5);
}

.beer-image:hover {
Expand Down Expand Up @@ -64,6 +74,7 @@ main {
max-width: 90%;
}


.beer-card h2 {
font-size: medium;
margin-bottom: 4px;
Expand Down Expand Up @@ -91,3 +102,7 @@ main {
position: absolute;
overflow: hidden;
}

.beer-card:hover, .beer-card:active {
background-color: greenyellow;
}
4 changes: 2 additions & 2 deletions src/components/BeerCard.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useState } from "react";

export default function BeerCard({ name, image, avgRating, setSelectedBeer }) {
export default function BeerCard({ name, image, avgRating, setSelectedBeer, isSelected }) {
const [hidden, setHidden] = useState(false)
if(hidden) return null
return (
<div className="beer-card" onClick={() => setSelectedBeer(name)}>
<div className={`beer-card ${isSelected && 'selected'}`} onClick={() => setSelectedBeer(name)}>
<div className="close-button" onClick={() => setHidden(true)}>x</div>
<div className="beer-image">
<img src={image} alt={name}
Expand Down
1 change: 1 addition & 0 deletions src/components/BeerList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default function BeerList() {
image={beer.image}
avgRating={beer.rating.average}
setSelectedBeer={setSelectedBeer}
isSelected={selectedBeer === beer.name}
/>
))
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function Header() {
return <h1>The Beers! (hey that's a bad joke) 🍻</h1>
return <h1>🍻 IPA's 🍻</h1>
}

0 comments on commit 499b3f6

Please sign in to comment.