fix: improve card sizing consistency across all pages

- Use flexbox layout with height: 100% for all cards
- Replace fixed heights with aspect-ratio: 16/9 for images
- Add text clamping (2 lines) for titles and descriptions
- Use margin-top: auto to push metadata to bottom
- Ensures cards maintain proportional box shapes

Files updated:
- Cookbooks.css: cookbook and recipe cards
- CookbookDetail.css: recipe cards
- RecipeList.css: recipe cards (removed 1:1 aspect ratio)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Paul R Kartchner
2026-01-18 21:41:37 -07:00
parent 70c9f8b751
commit 4ce62d5d3e
3 changed files with 79 additions and 8 deletions

View File

@@ -387,6 +387,9 @@
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
position: relative;
transition: transform 0.2s, box-shadow 0.2s;
display: flex;
flex-direction: column;
height: 100%;
}
.recipe-card:hover {
@@ -396,32 +399,48 @@
.recipe-card > div:first-child {
cursor: pointer;
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.recipe-image {
width: 100%;
height: 200px;
aspect-ratio: 16 / 9;
object-fit: cover;
flex-shrink: 0;
}
.recipe-image-placeholder {
width: 100%;
height: 200px;
aspect-ratio: 16 / 9;
background: linear-gradient(135deg, #ffb74d 0%, #ff9800 100%);
display: flex;
align-items: center;
justify-content: center;
font-size: 4rem;
flex-shrink: 0;
}
.recipe-info {
padding: 1.25rem;
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.recipe-info h3 {
font-size: 1.2rem;
color: #212121;
margin: 0 0 0.5rem 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.3;
}
.recipe-info .description {
@@ -429,6 +448,12 @@
color: #666;
margin: 0 0 0.75rem 0;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
flex: 0 0 auto;
}
.recipe-meta {
@@ -437,12 +462,14 @@
font-size: 0.85rem;
color: #757575;
margin-bottom: 0.75rem;
flex: 0 0 auto;
}
.recipe-tags {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: auto;
}
.recipe-tags .tag {

View File

@@ -156,6 +156,9 @@
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
display: flex;
flex-direction: column;
height: 100%;
}
.cookbook-card:hover {
@@ -165,28 +168,40 @@
.cookbook-cover {
width: 100%;
height: 200px;
aspect-ratio: 16 / 9;
object-fit: cover;
flex-shrink: 0;
}
.cookbook-cover-placeholder {
width: 100%;
height: 200px;
aspect-ratio: 16 / 9;
background: linear-gradient(135deg, #81c784 0%, #4caf50 100%);
display: flex;
align-items: center;
justify-content: center;
font-size: 4rem;
flex-shrink: 0;
}
.cookbook-info {
padding: 1.25rem;
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.cookbook-info h3 {
font-size: 1.3rem;
color: #212121;
margin: 0 0 0.5rem 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.3;
}
.cookbook-info .description {
@@ -194,6 +209,12 @@
color: #666;
margin: 0 0 0.75rem 0;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
flex: 0 0 auto;
}
.cookbook-info .recipe-count {
@@ -201,6 +222,7 @@
color: #2e7d32;
font-weight: 600;
margin: 0;
margin-top: auto;
}
/* Recent Recipes Section */
@@ -234,6 +256,9 @@
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
display: flex;
flex-direction: column;
height: 100%;
}
.recipe-card:hover {
@@ -243,28 +268,40 @@
.recipe-image {
width: 100%;
height: 200px;
aspect-ratio: 16 / 9;
object-fit: cover;
flex-shrink: 0;
}
.recipe-image-placeholder {
width: 100%;
height: 200px;
aspect-ratio: 16 / 9;
background: linear-gradient(135deg, #ffb74d 0%, #ff9800 100%);
display: flex;
align-items: center;
justify-content: center;
font-size: 4rem;
flex-shrink: 0;
}
.recipe-info {
padding: 1.25rem;
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.recipe-info h3 {
font-size: 1.2rem;
color: #212121;
margin: 0 0 0.5rem 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.3;
}
.recipe-info .description {
@@ -272,6 +309,12 @@
color: #666;
margin: 0 0 0.75rem 0;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
flex: 0 0 auto;
}
.recipe-meta {
@@ -279,6 +322,7 @@
gap: 1rem;
font-size: 0.85rem;
color: #757575;
margin-top: auto;
}
/* Empty State */

View File

@@ -266,9 +266,9 @@
overflow: hidden;
background: var(--bg-primary, #ffffff);
transition: transform 0.2s, box-shadow 0.2s;
aspect-ratio: 1 / 1;
display: flex;
flex-direction: column;
height: 100%;
}
.recipe-grid-enhanced .recipe-card:hover {
@@ -278,7 +278,7 @@
.recipe-grid-enhanced .recipe-card img {
width: 100%;
height: 65%;
aspect-ratio: 16 / 9;
object-fit: cover;
display: block;
flex-shrink: 0;