Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed stars to beers #1

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
4 changes: 4 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ main {
width: 260px;
}

.selected {
border: 1px solid #00ff48;
}

.beer-image {
width: 100%;
max-height: 500px;
Expand Down
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
Loading