Skip to content

Commit

Permalink
Added description in details/summary in Card.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnajman committed Apr 18, 2024
1 parent a33fd0f commit a645c83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/components/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function Card({ card }) {
} else if (card.location === "Online") {
badgeText = "ONLINE"
}

return (
<li className="card">
<div className="image">
Expand Down Expand Up @@ -63,6 +64,15 @@ function Card({ card }) {
</span>
</div>
</div>
{card.description && (
<details
id="description"
className="description"
>
<summary aria-controls="#description">Description</summary>
<p>{card.description}</p>
</details>
)}
</li>
)
}
Expand All @@ -80,6 +90,7 @@ Card.propTypes = {
title: PropTypes.string,
price: PropTypes.number,
unit: PropTypes.string,
description: PropTypes.string,
}),
}

Expand Down
10 changes: 9 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,18 @@ img {
gap: 0.5rem;
}

.title {
& .title {
font-weight: 400;
font-size: 1.2rem;
}

& .description {
max-width: 17.6rem;
& summary {
cursor: pointer;
font-weight: 600;
}
}
}

.page-footer {
Expand Down

0 comments on commit a645c83

Please sign in to comment.