Refactor gallery page to dynamically load product data using the Fetch API. This addresses a SyntaxError from incorrect script loading and updates the page to handle a new flattened data structure. - Replaced hardcoded product data with the Fetch API in `gallery-carousel.js`. - Updated selectors and logic to handle the new data structure. - Removed conflicting CSS rules for product cards. - Shortened all `longDescription` fields to 175 characters or less. - Widened the focused product card for better visibility without vertical scrolling. - Reduced vertical spacing between elements in product cards (title, description, price, button).
166 lines
3.7 KiB
CSS
166 lines
3.7 KiB
CSS
/* |--↓-↓-↓ Start gallery.html ↓-↓-↓--| */
|
|
#main-gallery {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
#gallery-top {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
width: 95vw;
|
|
gap: 20px;
|
|
}
|
|
|
|
#product-carousel-feature {
|
|
align-items: center;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
#product-carousel-feature h2 {
|
|
font-size: 1.875rem;
|
|
width: 50%;
|
|
text-align: center;
|
|
text-shadow: var(--text-shadow-layered);
|
|
color: var(--color-destin-sand);
|
|
background-color: var(--color-mid-green);
|
|
border: solid var(--color-destin-sand);
|
|
border-radius: 10px;
|
|
padding-left: 20px;
|
|
transform: translateX(30px);
|
|
box-shadow: var(--shadow-medium);
|
|
}
|
|
|
|
#product-category-card {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
text-align: center;
|
|
width: 65vw;
|
|
}
|
|
|
|
#product-carousel {
|
|
display: flex;
|
|
flex-direction: row; /* Flexbox layout for horizontal row */
|
|
gap: 20px; /* Space between product cards */
|
|
overflow-x: hidden; /* Changed from 'auto' to 'hidden' */
|
|
scroll-behavior: smooth; /* Smooth scrolling for buttons */
|
|
padding: 10px; /* Optional padding inside the carousel */
|
|
white-space: nowrap; /* Prevent wrapping to a new row */
|
|
transform: translateX(4vw);
|
|
min-height: 600px;
|
|
align-items: center;
|
|
}
|
|
|
|
.product-card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 300px;
|
|
min-width: 300px;
|
|
max-height: 350px;
|
|
flex: 0 0 auto; /* Prevent resizing of cards */
|
|
border: 1px solid var(--color-dark-green);
|
|
border-radius: 15px;
|
|
padding: 10px;
|
|
margin-left: 20px;
|
|
align-items: center;
|
|
text-align: center;
|
|
background-color: var(--color-destin-sand);
|
|
box-shadow: var(--shadow-subtle);
|
|
transition: all 0.5s ease-in-out; /* Added for smooth transitions */
|
|
}
|
|
|
|
.product-card h3,
|
|
.product-card .description,
|
|
.product-card p,
|
|
.product-card button {
|
|
margin-top: 5px; /* reduce vertical spacing */
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.product-card img {
|
|
margin-bottom: 5px; /* space between image and title */
|
|
}
|
|
|
|
.product-card img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
display: block;
|
|
border: solid var(--color-mid-green);
|
|
border-radius: 8px;
|
|
align-items: center;
|
|
}
|
|
|
|
/* New style for the centered card */
|
|
.product-card.is-centered {
|
|
width: 340px;
|
|
transform: scale(1.4);
|
|
box-shadow: var(--shadow-strong);
|
|
background-color: var(--color-destin-sand);
|
|
white-space: normal;
|
|
}
|
|
|
|
#scroll-left, #scroll-right {
|
|
cursor: pointer;
|
|
background-color: var(--color-dark-green);
|
|
color: white;
|
|
border: none;
|
|
padding: 10px;
|
|
border-radius: 50%;
|
|
font-size: 1.5rem;
|
|
transform: translateX(4.5vw);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.product-card {
|
|
min-width: 150px;
|
|
max-width: 200px;
|
|
}
|
|
|
|
#product-carousel {
|
|
gap: 5px;
|
|
}
|
|
}
|
|
|
|
#product-list {
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: 50px;
|
|
}
|
|
|
|
.add-to-cart-btn {
|
|
cursor: pointer;
|
|
background-color: var(--color-mid-green);
|
|
border: solid 1px var(--color-dark-green);
|
|
color: var(--color-dark-green);
|
|
font-weight: bold;
|
|
border-radius: 5px;
|
|
box-shadow: var(--shadow-strong);
|
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
}
|
|
|
|
.add-to-cart-btn:hover {
|
|
background-color: var(--color-destin-sand);
|
|
border: solid var(--color-dark-green);
|
|
color: var(--color-dark-green);
|
|
border-radius: 5px;
|
|
box-shadow: var(--shadow-strong);
|
|
}
|
|
|
|
#cart-details {
|
|
color: var(--color-dark-green);
|
|
font-size: 1.3rem;
|
|
font-weight: bold;
|
|
border: solid var(--color-dark-green);
|
|
border-radius: 10px;
|
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
}
|
|
|
|
#cart-details:hover {
|
|
background-color: var(--color-mid-green);
|
|
color: var(--color-destin-sand);
|
|
box-shadow: var(--shadow-medium);
|
|
}
|
|
/* |--↑-↑-↑ End gallery.html ↑-↑-↑--| */ |