Feat: Dynamic gallery page with Fetch API and improved product card layout
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).
This commit is contained in:
@@ -1,391 +1,363 @@
|
|||||||
/**
|
|
||||||
* @fileoverview This file contains the product data for
|
|
||||||
* all items in the store demo. The data is structured
|
|
||||||
* to be the single source of truth for all
|
|
||||||
* product-related information, including IDs, pricing,
|
|
||||||
* and descriptions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* **Unit Template**
|
|
||||||
{
|
|
||||||
productNumber: "",
|
|
||||||
imageFile: "",
|
|
||||||
skuID: "",
|
|
||||||
catNumber: "",
|
|
||||||
productName: "",
|
|
||||||
category: "",
|
|
||||||
price: ,
|
|
||||||
altText: "",
|
|
||||||
shortDescription: "",
|
|
||||||
longDescription: "",
|
|
||||||
ratings: {
|
|
||||||
count: ,
|
|
||||||
score:
|
|
||||||
},
|
|
||||||
isFeatured: ,
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const INVENTORY = [
|
const INVENTORY = [
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "bird-house.jpg",
|
"imageFile": "bird-house.jpg",
|
||||||
"skuID": "ACC",
|
"skuID": "ACC",
|
||||||
"catNumber": "01",
|
"catNumber": "01",
|
||||||
"productName": "Bird House - Pink",
|
"productName": "Bird House - Pink",
|
||||||
"category": "accessories",
|
"category": "accessories",
|
||||||
"price": 12.99,
|
"price": 12.99,
|
||||||
"altText": "A pink handcrafted wooden bird house",
|
"altText": "A pink handcrafted wooden bird house",
|
||||||
"shortDescription": "Handcrafted wooden bird house in pink.",
|
"shortDescription": "Handcrafted wooden bird house in pink.",
|
||||||
"longDescription": "A beautifully handcrafted wooden bird house in a gentle pink finish, built by a local carpenter from the Bloom Valley community. Designed with a classic aesthetic and durable, weather-resistant materials, this bird house provides a cozy and safe home for small songbirds. It's a charming accent for any garden or tree and a perfect way to invite nature into your outdoor space.",
|
"longDescription": "Handcrafted pink bird house, durable and weather-resistant, perfect for small songbirds and a charming garden accent.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 38,
|
"count": 38,
|
||||||
"score": 4.7
|
"score": 4.7
|
||||||
},
|
},
|
||||||
"isFeatured": true
|
"isFeatured": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "garden-pots.jpg",
|
"imageFile": "garden-pots.jpg",
|
||||||
"skuID": "ACC",
|
"skuID": "ACC",
|
||||||
"catNumber": "01",
|
"catNumber": "01",
|
||||||
"productName": "Gardening Pots - Terra-cotta",
|
"productName": "Gardening Pots - Terra-cotta",
|
||||||
"category": "accessories",
|
"category": "accessories",
|
||||||
"price": 9.99,
|
"price": 9.99,
|
||||||
"altText": "A set of three traditional terra-cotta gardening pots of varying sizes.",
|
"altText": "A set of three traditional terra-cotta gardening pots of varying sizes.",
|
||||||
"shortDescription": "Set of three classic terra-cotta garden pots.",
|
"shortDescription": "Set of three classic terra-cotta garden pots.",
|
||||||
"longDescription": "Crafted from porous, natural clay, this set of terra-cotta pots is a timeless choice for any gardener. The material's ability to absorb excess water helps prevent root rot, making it an ideal home for a wide variety of plants. The set includes three different sizes, perfect for potting new seedlings or housing larger plants.",
|
"longDescription": "Set of three terra-cotta pots in different sizes, ideal for seedlings or larger plants and perfect for any gardener.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 150,
|
"count": 150,
|
||||||
"score": 4.5
|
"score": 4.5
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "watering-can.jpg",
|
"imageFile": "watering-can.jpg",
|
||||||
"skuID": "ACC",
|
"skuID": "ACC",
|
||||||
"catNumber": "01",
|
"catNumber": "01",
|
||||||
"productName": "Watering Can",
|
"productName": "Watering Can",
|
||||||
"category": "accessories",
|
"category": "accessories",
|
||||||
"price": 19.99,
|
"price": 19.99,
|
||||||
"altText": "A modern, metal watering can with a long spout.",
|
"altText": "A modern, metal watering can with a long spout.",
|
||||||
"shortDescription": "Stylish and functional metal watering can.",
|
"shortDescription": "Stylish and functional metal watering can.",
|
||||||
"longDescription": "This sleek and durable metal watering can features a long, narrow spout for precise watering, perfect for both indoor and outdoor plants. Its comfortable handle provides a balanced grip, and the sturdy construction ensures it will be a reliable tool for years to come.",
|
"longDescription": "Sleek metal watering can with long spout and comfortable handle for precise watering indoors or outdoors.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 85,
|
"count": 85,
|
||||||
"score": 4.8
|
"score": 4.8
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "spider-plant.jpg",
|
"imageFile": "spider-plant.jpg",
|
||||||
"skuID": "IND",
|
"skuID": "IND",
|
||||||
"catNumber": "02",
|
"catNumber": "02",
|
||||||
"productName": "Spider Plant",
|
"productName": "Spider Plant",
|
||||||
"category": "indoor",
|
"category": "indoor",
|
||||||
"price": 14.99,
|
"price": 14.99,
|
||||||
"altText": "A lush spider plant with long, variegated green and white leaves.",
|
"altText": "A lush spider plant with long, variegated green and white leaves.",
|
||||||
"shortDescription": "Easy-care spider plant, great for beginners.",
|
"shortDescription": "Easy-care spider plant, great for beginners.",
|
||||||
"longDescription": "The spider plant (Chlorophytum comosum) is one of the most popular and easiest houseplants to grow. Known for its distinctive arching, variegated leaves, it thrives in a variety of conditions and is a great choice for hanging baskets. It's also a highly effective air purifier.",
|
"longDescription": "The spider plant thrives in many conditions, is easy to care for, and makes a great air-purifying houseplant.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 210,
|
"count": 210,
|
||||||
"score": 4.9
|
"score": 4.9
|
||||||
},
|
},
|
||||||
"isFeatured": true
|
"isFeatured": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "string-of-pearls.jpg",
|
"imageFile": "string-of-pearls.jpg",
|
||||||
"skuID": "IND",
|
"skuID": "IND",
|
||||||
"catNumber": "02",
|
"catNumber": "02",
|
||||||
"productName": "String-of-Pearls Plant",
|
"productName": "String-of-Pearls Plant",
|
||||||
"category": "indoor",
|
"category": "indoor",
|
||||||
"price": 16.99,
|
"price": 16.99,
|
||||||
"altText": "A cascading string-of-pearls plant with small, spherical green leaves.",
|
"altText": "A cascading string-of-pearls plant with small, spherical green leaves.",
|
||||||
"shortDescription": "Succulent with cascading, pearl-like foliage.",
|
"shortDescription": "Succulent with cascading, pearl-like foliage.",
|
||||||
"longDescription": "The string-of-pearls (Senecio rowleyanus) is a striking succulent known for its long, trailing stems dotted with small, bead-like leaves. It's a fantastic plant for a sunny spot on a shelf or in a hanging planter, creating a beautiful, flowing green display. Like most succulents, it requires minimal watering.",
|
"longDescription": "String-of-pearls succulent with trailing bead-like stems, ideal for shelves or hanging planters with minimal watering needs.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 95,
|
"count": 95,
|
||||||
"score": 4.6
|
"score": 4.6
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "zebra-plant.jpg",
|
"imageFile": "zebra-plant.jpg",
|
||||||
"skuID": "IND",
|
"skuID": "IND",
|
||||||
"catNumber": "02",
|
"catNumber": "02",
|
||||||
"productName": "Zebra Plant",
|
"productName": "Zebra Plant",
|
||||||
"category": "indoor",
|
"category": "indoor",
|
||||||
"price": 18.99,
|
"price": 18.99,
|
||||||
"altText": "A vibrant zebra plant with deep green leaves and prominent white veins.",
|
"altText": "A vibrant zebra plant with deep green leaves and prominent white veins.",
|
||||||
"shortDescription": "Striking houseplant with bold, striped leaves.",
|
"shortDescription": "Striking houseplant with bold, striped leaves.",
|
||||||
"longDescription": "The zebra plant (Aphelandra squarrosa) is named for its eye-catching foliage—deep green leaves with stark, contrasting white or yellow veins. This plant adds a tropical feel to any room and, with the right care, can also produce brilliant yellow flower bracts. It prefers bright, indirect light and high humidity.",
|
"longDescription": "Zebra plant with bold green leaves and white veins, adding a tropical feel; blooms bright yellow with proper care.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 72,
|
"count": 72,
|
||||||
"score": 4.4
|
"score": 4.4
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "bark-mulch.jpg",
|
"imageFile": "bark-mulch.jpg",
|
||||||
"skuID": "LND",
|
"skuID": "LND",
|
||||||
"catNumber": "03",
|
"catNumber": "03",
|
||||||
"productName": "Pine Bark Mulch (25lb bag)",
|
"productName": "Pine Bark Mulch (25lb bag)",
|
||||||
"category": "landscaping",
|
"category": "landscaping",
|
||||||
"price": 8.99,
|
"price": 8.99,
|
||||||
"altText": "A 25lb bag of natural pine bark mulch.",
|
"altText": "A 25lb bag of natural pine bark mulch.",
|
||||||
"shortDescription": "25lb bag of premium pine bark mulch.",
|
"shortDescription": "25lb bag of premium pine bark mulch.",
|
||||||
"longDescription": "Pine bark mulch is a top choice for gardeners and landscapers. It helps suppress weeds, retain soil moisture, and moderate soil temperature, which is essential for healthy plant growth. As it decomposes, it adds valuable organic matter to the soil. The rich, dark color also provides an attractive finish to garden beds and pathways.",
|
"longDescription": "Pine bark mulch helps suppress weeds, retain moisture, and enrich soil, adding a dark, polished look to gardens.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 305,
|
"count": 305,
|
||||||
"score": 4.8
|
"score": 4.8
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "pea-gravel.jpg",
|
"imageFile": "pea-gravel.jpg",
|
||||||
"skuID": "LND",
|
"skuID": "LND",
|
||||||
"catNumber": "03",
|
"catNumber": "03",
|
||||||
"productName": "Pea Gravel (25lb bag)",
|
"productName": "Pea Gravel (25lb bag)",
|
||||||
"category": "landscaping",
|
"category": "landscaping",
|
||||||
"price": 11.99,
|
"price": 11.99,
|
||||||
"altText": "A 25lb bag of smooth, rounded pea gravel.",
|
"altText": "A 25lb bag of smooth, rounded pea gravel.",
|
||||||
"shortDescription": "25lb bag of decorative pea gravel.",
|
"shortDescription": "25lb bag of decorative pea gravel.",
|
||||||
"longDescription": "Pea gravel consists of small, smooth, rounded stones, typically in a mix of neutral colors. It's an excellent choice for creating walkways, patios, and decorative ground cover. The smooth texture is comfortable to walk on, and it provides effective drainage and a clean, finished look to any landscape design.",
|
"longDescription": "Pea gravel is smooth, rounded stones perfect for walkways, patios, and decorative ground cover, providing drainage and a clean finish.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 185,
|
"count": 185,
|
||||||
"score": 4.7
|
"score": 4.7
|
||||||
},
|
},
|
||||||
"isFeatured": true
|
"isFeatured": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "stone-pavers.jpg",
|
"imageFile": "stone-pavers.jpg",
|
||||||
"skuID": "LND",
|
"skuID": "LND",
|
||||||
"catNumber": "03",
|
"catNumber": "03",
|
||||||
"productName": "Stone Pavers (single count)",
|
"productName": "Stone Pavers (single count)",
|
||||||
"category": "landscaping",
|
"category": "landscaping",
|
||||||
"price": 4.50,
|
"price": 4.50,
|
||||||
"altText": "A single rectangular gray stone paver.",
|
"altText": "A single rectangular gray stone paver.",
|
||||||
"shortDescription": "Durable stone paver for patios and paths.",
|
"shortDescription": "Durable stone paver for patios and paths.",
|
||||||
"longDescription": "Our stone pavers are made from high-quality concrete and are perfect for building durable, long-lasting patios, walkways, and driveways. The classic rectangular shape and neutral gray color make them versatile for a wide range of landscape designs. Sold individually, allowing you to purchase the exact quantity you need for your project.",
|
"longDescription": "High-quality stone pavers, perfect for patios, paths, and driveways. Sold individually for precise quantity needs.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 255,
|
"count": 255,
|
||||||
"score": 4.6
|
"score": 4.6
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "firepit.jpg",
|
"imageFile": "firepit.jpg",
|
||||||
"skuID": "PAT",
|
"skuID": "PAT",
|
||||||
"catNumber": "04",
|
"catNumber": "04",
|
||||||
"productName": "Metal Fire-pit",
|
"productName": "Metal Fire-pit",
|
||||||
"category": "patio",
|
"category": "patio",
|
||||||
"price": 129.99,
|
"price": 129.99,
|
||||||
"altText": "A round, black metal fire-pit with a mesh lid.",
|
"altText": "A round, black metal fire-pit with a mesh lid.",
|
||||||
"shortDescription": "Stylish metal fire-pit for outdoor gatherings.",
|
"shortDescription": "Stylish metal fire-pit for outdoor gatherings.",
|
||||||
"longDescription": "Create a warm and inviting atmosphere on your patio with this durable metal fire-pit. Constructed from heat-resistant steel, it features a classic bowl design and includes a mesh lid for safety. Perfect for cool evenings, it's a great centerpiece for entertaining and enjoying the outdoors with friends and family.",
|
"longDescription": "Metal fire-pit with mesh lid, heat-resistant and durable, perfect for outdoor gatherings and cozy evenings.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 55,
|
"count": 55,
|
||||||
"score": 4.9
|
"score": 4.9
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "string-lights.jpg",
|
"imageFile": "string-lights.jpg",
|
||||||
"skuID": "PAT",
|
"skuID": "PAT",
|
||||||
"catNumber": "04",
|
"catNumber": "04",
|
||||||
"productName": "LED String Lights",
|
"productName": "LED String Lights",
|
||||||
"category": "patio",
|
"category": "patio",
|
||||||
"price": 24.99,
|
"price": 24.99,
|
||||||
"altText": "A string of warm white LED lights hanging outdoors.",
|
"altText": "A string of warm white LED lights hanging outdoors.",
|
||||||
"shortDescription": "Energy-efficient LED string lights for outdoors.",
|
"shortDescription": "Energy-efficient LED string lights for outdoors.",
|
||||||
"longDescription": "Add a touch of magic to your outdoor space with these energy-efficient LED string lights. The warm white glow creates a soft, inviting ambiance, perfect for backyard dinners, parties, or simply relaxing on your patio. The bulbs are shatterproof and weather-resistant, making them ideal for year-round outdoor use.",
|
"longDescription": "LED string lights with warm glow, shatterproof and weather-resistant, ideal for outdoor ambiance year-round.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 175,
|
"count": 175,
|
||||||
"score": 4.7
|
"score": 4.7
|
||||||
},
|
},
|
||||||
"isFeatured": true
|
"isFeatured": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "parlor-palm.jpg",
|
"imageFile": "parlor-palm.jpg",
|
||||||
"skuID": "PAT",
|
"skuID": "PAT",
|
||||||
"catNumber": "04",
|
"catNumber": "04",
|
||||||
"productName": "Parlor Palm",
|
"productName": "Parlor Palm",
|
||||||
"category": "patio",
|
"category": "patio",
|
||||||
"price": 22.99,
|
"price": 22.99,
|
||||||
"altText": "A small, potted parlor palm with feathery green fronds.",
|
"altText": "A small, potted parlor palm with feathery green fronds.",
|
||||||
"shortDescription": "Elegant, low-maintenance palm for patios.",
|
"shortDescription": "Elegant, low-maintenance palm for patios.",
|
||||||
"longDescription": "The parlor palm (Chamaedorea elegans) is a classic choice for adding a tropical flair to a covered patio, deck, or indoor space. Known for its graceful, feathery fronds, it's a resilient and slow-growing plant that thrives in low light conditions. It's a great way to bring a lush, green aesthetic to your outdoor living area.",
|
"longDescription": "Parlor palm with graceful fronds, resilient in low light, adding a tropical flair to patios or indoor spaces.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 88,
|
"count": 88,
|
||||||
"score": 4.6
|
"score": 4.6
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "hydrangea.jpg",
|
"imageFile": "hydrangea.jpg",
|
||||||
"skuID": "SHR",
|
"skuID": "SHR",
|
||||||
"catNumber": "05",
|
"catNumber": "05",
|
||||||
"productName": "Hydrangeas",
|
"productName": "Hydrangeas",
|
||||||
"category": "shrubs",
|
"category": "shrubs",
|
||||||
"price": 25.99,
|
"price": 25.99,
|
||||||
"altText": "A vibrant cluster of pink and purple hydrangea flowers.",
|
"altText": "A vibrant cluster of pink and purple hydrangea flowers.",
|
||||||
"shortDescription": "Hydrangea bush with large, colorful blooms.",
|
"shortDescription": "Hydrangea bush with large, colorful blooms.",
|
||||||
"longDescription": "Hydrangeas are a quintessential garden shrub, celebrated for their large, showy flower heads. Depending on the soil's pH, the blooms can change color, ranging from deep blues and purples to bright pinks. They are perfect for adding a splash of color to borders, foundations, or as a standalone focal point in the garden.",
|
"longDescription": "Hydrangeas with large, colorful blooms, ideal for borders, foundations, or as a standalone garden focal point.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 190,
|
"count": 190,
|
||||||
"score": 4.9
|
"score": 4.9
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "crepe-myrtle.jpg",
|
"imageFile": "crepe-myrtle.jpg",
|
||||||
"skuID": "SHR",
|
"skuID": "SHR",
|
||||||
"catNumber": "05",
|
"catNumber": "05",
|
||||||
"productName": "Crepe Myrtle",
|
"productName": "Crepe Myrtle",
|
||||||
"category": "shrubs",
|
"category": "shrubs",
|
||||||
"price": 28.99,
|
"price": 28.99,
|
||||||
"altText": "A crepe myrtle bush with clusters of bright pink flowers.",
|
"altText": "A crepe myrtle bush with clusters of bright pink flowers.",
|
||||||
"shortDescription": "Crepe myrtle with long-lasting summer blooms.",
|
"shortDescription": "Crepe myrtle with vibrant summer blooms.",
|
||||||
"longDescription": "The crepe myrtle (Lagerstroemia) is a beloved small tree or shrub, famous for its crepe-paper-like blossoms that last all summer long. Its smooth, multi-hued bark and vibrant fall foliage also add year-round interest to the landscape. This fast-growing plant thrives in sunny locations and requires minimal care.",
|
"longDescription": "Crepe myrtle with vibrant, long-lasting summer blooms and smooth multi-hued bark, adding seasonal interest to your garden.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 115,
|
"count": 115,
|
||||||
"score": 4.7
|
"score": 4.7
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "holly.jpg",
|
"imageFile": "holly.jpg",
|
||||||
"skuID": "SHR",
|
"skuID": "SHR",
|
||||||
"catNumber": "05",
|
"catNumber": "05",
|
||||||
"productName": "Holly",
|
"productName": "Holly",
|
||||||
"category": "shrubs",
|
"category": "shrubs",
|
||||||
"price": 21.99,
|
"price": 21.99,
|
||||||
"altText": "A holly bush with deep green leaves and bright red berries.",
|
"altText": "A holly bush with deep green leaves and bright red berries.",
|
||||||
"shortDescription": "Evergreen holly bush with bright red berries.",
|
"shortDescription": "Evergreen holly bush with bright red berries.",
|
||||||
"longDescription": "Holly (Ilex) is a traditional favorite for its glossy, evergreen leaves and bright red berries that provide winter interest. It's an excellent choice for creating hedges, screens, or as a structural plant in the garden. This hardy shrub is a staple for year-round beauty and can attract birds with its berries.",
|
"longDescription": "Holly with glossy evergreen leaves and bright red berries, perfect for hedges, screens, or year-round garden interest.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 130,
|
"count": 130,
|
||||||
"score": 4.8
|
"score": 4.8
|
||||||
},
|
},
|
||||||
"isFeatured": true
|
"isFeatured": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "gardening-tool.jpg",
|
"imageFile": "gardening-tools.jpg",
|
||||||
"skuID": "TLS",
|
"skuID": "TLS",
|
||||||
"catNumber": "06",
|
"catNumber": "06",
|
||||||
"productName": "Gardening Tool Set",
|
"productName": "Gardening Tool Set",
|
||||||
"category": "tools",
|
"category": "tools",
|
||||||
"price": 34.99,
|
"price": 34.99,
|
||||||
"altText": "A set of three gardening tools: a trowel, a cultivator, and a transplanter.",
|
"altText": "A set of three gardening tools: a trowel, a cultivator, and a transplanter.",
|
||||||
"shortDescription": "Three-piece set of essential gardening tools.",
|
"shortDescription": "Three-piece set of essential gardening tools.",
|
||||||
"longDescription": "This durable gardening tool set includes a trowel for planting, a cultivator for aerating soil, and a transplanter for moving seedlings. Each tool features a comfortable handle and a sturdy, rust-resistant head. It's the perfect starter set for anyone looking to get their hands dirty in the garden.",
|
"longDescription": "Gardening tool set includes trowel, cultivator, and transplanter with sturdy, rust-resistant heads and comfortable handles.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 200,
|
"count": 200,
|
||||||
"score": 4.7
|
"score": 4.7
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "gardening-hose.jpg",
|
"imageFile": "garden-hose.jpg",
|
||||||
"skuID": "TLS",
|
"skuID": "TLS",
|
||||||
"catNumber": "06",
|
"catNumber": "06",
|
||||||
"productName": "Gardening Hose",
|
"productName": "Gardening Hose",
|
||||||
"category": "tools",
|
"category": "tools",
|
||||||
"price": 49.99,
|
"price": 49.99,
|
||||||
"altText": "A coiled green gardening hose.",
|
"altText": "A coiled green gardening hose.",
|
||||||
"shortDescription": "Durable, kink-resistant gardening hose.",
|
"shortDescription": "Durable, kink-resistant gardening hose.",
|
||||||
"longDescription": "Our premium gardening hose is made from a high-quality, flexible material that resists kinking and tangling. It's lightweight yet incredibly durable, making watering your garden a breeze. The hose comes with solid brass couplings for a secure, leak-free connection to your spigot.",
|
"longDescription": "Durable, flexible garden hose resists kinks, lightweight yet sturdy, with brass couplings for secure connections.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 110,
|
"count": 110,
|
||||||
"score": 4.5
|
"score": 4.5
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "wheelbarrow.jpg",
|
"imageFile": "wheelbarrow.jpg",
|
||||||
"skuID": "TLS",
|
"skuID": "TLS",
|
||||||
"catNumber": "06",
|
"catNumber": "06",
|
||||||
"productName": "Wheelbarrow",
|
"productName": "Wheelbarrow",
|
||||||
"category": "tools",
|
"category": "tools",
|
||||||
"price": 99.99,
|
"price": 99.99,
|
||||||
"altText": "A sturdy single-wheeled wheelbarrow with a metal basin.",
|
"altText": "A sturdy single-wheeled wheelbarrow with a metal basin.",
|
||||||
"shortDescription": "Heavy-duty wheelbarrow for hauling tasks.",
|
"shortDescription": "Heavy-duty wheelbarrow for hauling tasks.",
|
||||||
"longDescription": "This robust wheelbarrow is an essential tool for any serious gardener or landscaper. It features a deep, heavy-duty steel basin and a strong single wheel for easy maneuverability, even on uneven terrain. Perfect for transporting soil, mulch, stones, and other heavy materials around your yard.",
|
"longDescription": "Heavy-duty single-wheel wheelbarrow with steel basin, ideal for transporting soil, mulch, stones, or other heavy materials.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 65,
|
"count": 65,
|
||||||
"score": 4.9
|
"score": 4.9
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "001",
|
"productNumber": "001",
|
||||||
"imageFile": "apple-tree.jpg",
|
"imageFile": "apple-tree.jpg",
|
||||||
"skuID": "TRS",
|
"skuID": "TRS",
|
||||||
"catNumber": "07",
|
"catNumber": "07",
|
||||||
"productName": "Apple Tree (Honeycrisp)",
|
"productName": "Apple Tree (Honeycrisp)",
|
||||||
"category": "trees",
|
"category": "trees",
|
||||||
"price": 45.99,
|
"price": 45.99,
|
||||||
"altText": "A young Honeycrisp apple tree in a pot.",
|
"altText": "A young Honeycrisp apple tree in a pot.",
|
||||||
"shortDescription": "Honeycrisp apple tree with crisp, sweet fruit.",
|
"shortDescription": "Honeycrisp apple tree with crisp, sweet fruit.",
|
||||||
"longDescription": "The Honeycrisp apple tree is a popular choice for home orchards, celebrated for its exceptionally crisp texture and deliciously sweet flavor. This semi-dwarf tree is relatively easy to care for and produces a bountiful harvest of apples in the late summer and early fall. Plant it in a sunny spot to ensure a great yield.",
|
"longDescription": "Honeycrisp apple tree produces crisp, sweet apples and is easy to care for in a sunny home orchard.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 140,
|
"count": 140,
|
||||||
"score": 4.8
|
"score": 4.8
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "002",
|
"productNumber": "002",
|
||||||
"imageFile": "silver-birch.jpg",
|
"imageFile": "silver-birch.jpg",
|
||||||
"skuID": "TRS",
|
"skuID": "TRS",
|
||||||
"catNumber": "07",
|
"catNumber": "07",
|
||||||
"productName": "Silver Birch",
|
"productName": "Silver Birch",
|
||||||
"category": "trees",
|
"category": "trees",
|
||||||
"price": 39.99,
|
"price": 39.99,
|
||||||
"altText": "A young silver birch tree with smooth, white bark.",
|
"altText": "A young silver birch tree with smooth, white bark.",
|
||||||
"shortDescription": "Graceful silver birch with iconic white bark.",
|
"shortDescription": "Graceful silver birch with iconic white bark.",
|
||||||
"longDescription": "The silver birch (Betula pendula) is a stunning ornamental tree prized for its peeling, silvery-white bark and elegant, pendulous branches. It provides year-round visual interest and is an excellent choice for a focal point in your yard. This hardy tree is fast-growing and adds a touch of classic beauty to any landscape.",
|
"longDescription": "Silver birch with elegant, pendulous branches and silvery-white bark, adding year-round beauty and a classic focal point.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 95,
|
"count": 95,
|
||||||
"score": 4.6
|
"score": 4.6
|
||||||
},
|
},
|
||||||
"isFeatured": false
|
"isFeatured": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"productNumber": "003",
|
"productNumber": "003",
|
||||||
"imageFile": "japanese-maple-tree.jpg",
|
"imageFile": "japanese-maple-tree.jpg",
|
||||||
"skuID": "TRS",
|
"skuID": "TRS",
|
||||||
"catNumber": "07",
|
"catNumber": "07",
|
||||||
"productName": "Japanese Maple",
|
"productName": "Japanese Maple",
|
||||||
"category": "trees",
|
"category": "trees",
|
||||||
"price": 55.99,
|
"price": 55.99,
|
||||||
"altText": "A young Japanese Maple tree with lobed red and orange leaves.",
|
"altText": "A young Japanese Maple tree with lobed red and orange leaves.",
|
||||||
"shortDescription": "Japanese Maple tree with vibrant fall colors.",
|
"shortDescription": "Japanese Maple tree with vibrant fall colors.",
|
||||||
"longDescription": "Japanese Maple trees (Acer palmatum) are a native of landscapes in northeastern Asia, cherished for their beautiful, lobed leaves and spectacular fall foliage. This young tree will grow into a stunning accent to your garden, providing a vibrant backdrop and a brilliant display of reds, oranges, and yellows in the autumn. It's a robust and long-living addition to any property.",
|
"longDescription": "Japanese Maple with lobed red-orange leaves, adding vibrant autumn color and a stunning accent to any garden.",
|
||||||
"ratings": {
|
"ratings": {
|
||||||
"count": 220,
|
"count": 220,
|
||||||
"score": 4.9
|
"score": 4.9
|
||||||
},
|
},
|
||||||
"isFeatured": true
|
"isFeatured": true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
INVENTORY
|
INVENTORY
|
||||||
};
|
};
|
||||||
|
@@ -42,11 +42,11 @@ pageScripts:
|
|||||||
>
|
>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="gallery-bottom">
|
||||||
|
<button id="cart-details">View Shopping Cart</button>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% include "category-nav.njk" %}
|
{% include "category-nav.njk" %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="gallery-bottom">
|
|
||||||
<button id="cart-details">View Shopping Cart</button>
|
|
||||||
</div>
|
|
5
src/inventory.json.njk
Normal file
5
src/inventory.json.njk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
permalink: "/data/inventory.json"
|
||||||
|
---
|
||||||
|
|
||||||
|
{{ inventory.INVENTORY | dump | safe }}
|
@@ -1,130 +1,132 @@
|
|||||||
// Gallery Carousel .js
|
// --- Carousel State ---
|
||||||
const products = {
|
let allProducts = [];
|
||||||
trees: [
|
let selectedProducts = [];
|
||||||
{ id: 1, name: "Crepe Mertyl Tree", description: "Beautiful Crepe Mertyl tree.", price: 55.00, image: "images/trees/crepe-mertyl.jpg" },
|
let currentIndex = 0;
|
||||||
{ id: 2, name: "Silver Birch Tree", description: "Sturdy Silver Birch tree.", price: 45.00, image: "images/trees/silver-birch.jpg" },
|
|
||||||
{ id: 3, name: "Apple Tree", description: "Fruitful apple tree.", price: 35.00, image: "images/trees/apple-tree.jpg" },
|
// --- Helpers ---
|
||||||
{ id: 4, name: "Potted Spruce Tree", description: "Miniature Spruce in a white planter.", price: 35.00, image: "images/trees/potted-spruce.jpg" }
|
const getProductId = (product) => {
|
||||||
],
|
return `${product.skuID}-${product.catNumber}-${product.productNumber}`;
|
||||||
indoor: [
|
|
||||||
{ id: 5, name: "Aloe Plant", description: "Thrives with 6-8 hours of direct sunlight a day.", price: 15.00, image: "images/indoor/aloe-plant.jpg" },
|
|
||||||
{ id: 6, name: "Peperonia Plant", description: "Low-maintenance and perfect for spaces with lots of natural light.", price: 12.50, image: "images/indoor/peperonia.jpg" },
|
|
||||||
{ id: 7, name: "String-of-Pearls Plant", description: "Best placed in east-facing windows or on shaded patios and balconies.", price: 20.00, image: "images/indoor/string-of-pearls.jpg" },
|
|
||||||
{ id: 12, name: "Venus Fly Trap", description: "Perfect for young botanists or your fly problem!", price: 12.50, image: "images/indoor/venus-fly-trap.jpg"}
|
|
||||||
],
|
|
||||||
tools: [
|
|
||||||
{ id: 8, name: "Watering Cans", description: "Galvanized aluminum watering cans (x2).", price: 25.00, image: "images/tools/watering-cans.jpg" },
|
|
||||||
{ id: 9, name: "Potting Soil", description: "Premium-blend of nutrient-rich potting soil - 10 lb bag.", price: 8.00, image: "images/tools/potting-soil.png" },
|
|
||||||
{ id: 10, name: "Bird House", description: "Handmade wooden bird house for hanging or mounting.", price: 11.00, image: "images/tools/birdhouse.jpg" },
|
|
||||||
{ id: 11, name: "Gardening Tools", description: "Wooden handled gardening tools.", price: 20.00, image: "images/tools/gardening-tools.jpg"}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
// --- Render the three visible items ---
|
||||||
console.log("DOM fully loaded and parsed"); // Check if the DOM is ready
|
const renderCarousel = () => {
|
||||||
|
|
||||||
const productCarousel = document.getElementById('product-carousel');
|
|
||||||
const scrollLeftButton = document.getElementById('scroll-left');
|
|
||||||
const scrollRightButton = document.getElementById('scroll-right');
|
|
||||||
const categoryButtons = document.querySelectorAll('.cat-btn');
|
|
||||||
|
|
||||||
// Scroll button functionality
|
|
||||||
scrollLeftButton.addEventListener('click', () => {
|
|
||||||
productCarousel.scrollBy({ left: -300, behavior: 'smooth' });
|
|
||||||
});
|
|
||||||
|
|
||||||
scrollRightButton.addEventListener('click', () => {
|
|
||||||
productCarousel.scrollBy({ left: 300, behavior: 'smooth' });
|
|
||||||
});
|
|
||||||
|
|
||||||
// Map buttons to categories
|
|
||||||
categoryButtons.forEach(button => {
|
|
||||||
button.addEventListener('click', (event) => {
|
|
||||||
event.preventDefault(); // Prevent default navigation
|
|
||||||
const url = new URL(button.href); // Parse the URL
|
|
||||||
const category = url.searchParams.get('category'); // Get category from the query parameter
|
|
||||||
updateProductList(category); // Update the product list
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Load default category or the one from the current URL
|
|
||||||
const currentUrl = new URL(window.location.href);
|
|
||||||
const defaultCategory = currentUrl.searchParams.get('category') || 'trees';
|
|
||||||
updateProductList(defaultCategory);
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateScrollButtons() {
|
|
||||||
const scrollLeftButton = document.getElementById('scroll-left');
|
|
||||||
const scrollRightButton = document.getElementById('scroll-right');
|
|
||||||
const productCarousel = document.getElementById('product-carousel');
|
|
||||||
|
|
||||||
scrollLeftButton.style.display = productCarousel.scrollLeft === 0 ? 'none' : 'block';
|
|
||||||
scrollRightButton.style.display =
|
|
||||||
productCarousel.scrollWidth - productCarousel.clientWidth === productCarousel.scrollLeft
|
|
||||||
? 'none'
|
|
||||||
: 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateProductList(category) {
|
|
||||||
const productList = document.getElementById("product-list");
|
const productList = document.getElementById("product-list");
|
||||||
if (!productList) {
|
productList.innerHTML = "";
|
||||||
console.error("Element with ID 'product-list' not found in the DOM.");
|
|
||||||
|
if (selectedProducts.length === 0) return;
|
||||||
|
|
||||||
|
// Calculate indexes for left, center, right
|
||||||
|
const leftIndex = (currentIndex - 1 + selectedProducts.length) % selectedProducts.length;
|
||||||
|
const centerIndex = currentIndex;
|
||||||
|
const rightIndex = (currentIndex + 1) % selectedProducts.length;
|
||||||
|
|
||||||
|
const visibleIndexes = [leftIndex, centerIndex, rightIndex];
|
||||||
|
|
||||||
|
visibleIndexes.forEach((idx, position) => {
|
||||||
|
const product = selectedProducts[idx];
|
||||||
|
const productId = getProductId(product);
|
||||||
|
|
||||||
|
const card = document.createElement("div");
|
||||||
|
card.className = "product-card";
|
||||||
|
if (position === 1) card.classList.add("is-centered");
|
||||||
|
|
||||||
|
card.dataset.productId = productId;
|
||||||
|
card.innerHTML = `
|
||||||
|
<img src="../images/_s-thumbs/${product.category}/${product.imageFile}" alt="${product.altText}">
|
||||||
|
<h3>${product.productName}</h3>
|
||||||
|
<p class="description">${position === 1 ? product.longDescription : product.shortDescription}</p>
|
||||||
|
<p>$${product.price}</p>
|
||||||
|
<button class="add-to-cart-btn" data-product-id="${productId}">Add to Cart</button>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Event listeners
|
||||||
|
card.querySelector('.add-to-cart-btn')
|
||||||
|
.addEventListener('click', () => addToCart(productId, allProducts));
|
||||||
|
|
||||||
|
card.addEventListener('click', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
if (position === 0) prevProduct(); // left → move backward
|
||||||
|
if (position === 2) nextProduct(); // right → move forward
|
||||||
|
});
|
||||||
|
|
||||||
|
productList.appendChild(card);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- Navigation ---
|
||||||
|
const nextProduct = () => {
|
||||||
|
currentIndex = (currentIndex + 1) % selectedProducts.length;
|
||||||
|
renderCarousel();
|
||||||
|
};
|
||||||
|
|
||||||
|
const prevProduct = () => {
|
||||||
|
currentIndex = (currentIndex - 1 + selectedProducts.length) % selectedProducts.length;
|
||||||
|
renderCarousel();
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- Category Update ---
|
||||||
|
const updateProductList = (category) => {
|
||||||
|
const productList = document.getElementById("product-list");
|
||||||
|
if (!productList) return console.error("Element with ID 'product-list' not found.");
|
||||||
|
|
||||||
|
selectedProducts = allProducts.filter(product => product.category === category);
|
||||||
|
currentIndex = 0;
|
||||||
|
|
||||||
|
if (selectedProducts.length === 0) {
|
||||||
|
console.error(`No products found for category: ${category}`);
|
||||||
|
productList.innerHTML = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
productList.innerHTML = ""; // Clear existing products
|
renderCarousel();
|
||||||
console.log(`Updating product list for category: ${category}`); // Debugging line
|
};
|
||||||
|
|
||||||
const selectedProducts = products[category];
|
// --- Cart ---
|
||||||
|
const addToCart = (productId, products) => {
|
||||||
|
const product = products.find(p => getProductId(p) === productId);
|
||||||
|
if (!product) return;
|
||||||
|
|
||||||
if (selectedProducts) {
|
let cart = JSON.parse(sessionStorage.getItem('cart')) || [];
|
||||||
selectedProducts.forEach(product => {
|
const existing = cart.find(item => getProductId(item) === productId);
|
||||||
const productCard = document.createElement("div");
|
|
||||||
productCard.className = "product-card";
|
|
||||||
|
|
||||||
console.log(`Creating product card for: ${product.name}`); // Debugging line
|
if (existing) {
|
||||||
|
existing.quantity++;
|
||||||
productCard.innerHTML = `
|
|
||||||
<img src="${product.image}" alt="${product.name}">
|
|
||||||
<h3>${product.name}</h3>
|
|
||||||
<p>${product.description}</p>
|
|
||||||
<p>$${product.price}</p>
|
|
||||||
<button class="add-to-cart-btn" data-product-id="${product.id}">Add to Cart</button>
|
|
||||||
`;
|
|
||||||
productList.appendChild(productCard);
|
|
||||||
|
|
||||||
// Add event listener for "Add to Cart" button
|
|
||||||
const addToCartButton = productCard.querySelector('.add-to-cart-btn');
|
|
||||||
addToCartButton.addEventListener('click', () => {
|
|
||||||
addToCart(product.id);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
console.error(`No products found for category: ${category}`);
|
cart.push({ ...product, quantity: 1 });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function addToCart(productId) {
|
sessionStorage.setItem('cart', JSON.stringify(cart));
|
||||||
const product = findProductById(productId);
|
alert(`${product.productName} has been added to your cart!`);
|
||||||
if (product) {
|
};
|
||||||
let cart = JSON.parse(sessionStorage.getItem('cart')) || [];
|
|
||||||
const existingProduct = cart.find(item => item.id === productId);
|
|
||||||
|
|
||||||
if (existingProduct) {
|
// --- Init ---
|
||||||
existingProduct.quantity++;
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
} else {
|
fetch("../data/inventory.json")
|
||||||
cart.push({ ...product, quantity: 1 });
|
.then(r => r.json())
|
||||||
}
|
.then(products => {
|
||||||
|
allProducts = products;
|
||||||
|
|
||||||
sessionStorage.setItem('cart', JSON.stringify(cart));
|
const scrollLeftButton = document.getElementById('scroll-left');
|
||||||
alert(`${product.name} has been added to your cart!`);
|
const scrollRightButton = document.getElementById('scroll-right');
|
||||||
}
|
const categoryButtons = document.querySelectorAll(".cat-btn");
|
||||||
}
|
|
||||||
|
|
||||||
function findProductById(productId) {
|
scrollLeftButton.addEventListener('click', prevProduct);
|
||||||
for (let category in products) {
|
scrollRightButton.addEventListener('click', nextProduct);
|
||||||
const product = products[category].find(item => item.id === productId);
|
|
||||||
if (product) return product;
|
categoryButtons.forEach(button => {
|
||||||
}
|
button.addEventListener('click', (event) => {
|
||||||
return null;
|
event.preventDefault();
|
||||||
}
|
const url = new URL(button.href);
|
||||||
|
const category = url.searchParams.get('category');
|
||||||
|
updateProductList(category);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentUrl = new URL(window.location.href);
|
||||||
|
const defaultCategory = currentUrl.searchParams.get('category') || 'trees';
|
||||||
|
updateProductList(defaultCategory);
|
||||||
|
})
|
||||||
|
.catch(err => console.error('Problem fetching products:', err));
|
||||||
|
});
|
||||||
|
@@ -13,8 +13,15 @@
|
|||||||
gap: 20px;
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#product-carousel-feature {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
#product-carousel-feature h2 {
|
#product-carousel-feature h2 {
|
||||||
font-size: 1.875rem;
|
font-size: 1.875rem;
|
||||||
|
width: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-shadow: var(--text-shadow-layered);
|
text-shadow: var(--text-shadow-layered);
|
||||||
color: var(--color-destin-sand);
|
color: var(--color-destin-sand);
|
||||||
@@ -35,42 +42,69 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#product-carousel {
|
#product-carousel {
|
||||||
display: flex; /* Flexbox layout for horizontal row */
|
display: flex;
|
||||||
|
flex-direction: row; /* Flexbox layout for horizontal row */
|
||||||
gap: 20px; /* Space between product cards */
|
gap: 20px; /* Space between product cards */
|
||||||
overflow-x: auto; /* Enable horizontal scrolling */
|
overflow-x: hidden; /* Changed from 'auto' to 'hidden' */
|
||||||
scroll-behavior: smooth; /* Smooth scrolling for buttons */
|
scroll-behavior: smooth; /* Smooth scrolling for buttons */
|
||||||
padding: 10px; /* Optional padding inside the carousel */
|
padding: 10px; /* Optional padding inside the carousel */
|
||||||
white-space: nowrap; /* Prevent wrapping to a new row */
|
white-space: nowrap; /* Prevent wrapping to a new row */
|
||||||
transform: translateX(4vw);
|
transform: translateX(4vw);
|
||||||
|
min-height: 600px;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-card {
|
.product-card {
|
||||||
display: inline-block; /* Ensure cards stay in a row */
|
display: flex;
|
||||||
min-width: 150px; /* Set the card size */
|
flex-direction: column;
|
||||||
max-width: 200px;
|
width: 300px;
|
||||||
max-height: auto;
|
min-width: 300px;
|
||||||
|
max-height: 350px;
|
||||||
flex: 0 0 auto; /* Prevent resizing of cards */
|
flex: 0 0 auto; /* Prevent resizing of cards */
|
||||||
border: 1px solid #ddd; /* Optional border */
|
border: 1px solid var(--color-dark-green);
|
||||||
border-radius: 8px;
|
border-radius: 15px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
white-space: wrap;
|
background-color: var(--color-destin-sand);
|
||||||
background-color: var(--color-destin-sand); /* Optional background */
|
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 {
|
.product-card img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
|
border: solid var(--color-mid-green);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
align-items: center;
|
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 {
|
#scroll-left, #scroll-right {
|
||||||
cursor: pointer; /* Show pointer to indicate clickable buttons */
|
cursor: pointer;
|
||||||
background-color: var(--color-dark-green); /* Dark green background */
|
background-color: var(--color-dark-green);
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -90,81 +124,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#product-list {
|
||||||
#main-gallery #right-aside {
|
|
||||||
width: 25vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main-gallery #right-aside h2 {
|
|
||||||
font-size: 1.675rem;
|
|
||||||
background-color: var(--color-light-teal);
|
|
||||||
color: var(--color-dark-green);
|
|
||||||
border: solid var(--color-dark-green);
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0 5px;
|
|
||||||
white-space: nowrap;
|
|
||||||
box-shadow: var(--shadow-strong);
|
|
||||||
}
|
|
||||||
|
|
||||||
#main-gallery .categories ul {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
align-items: center;
|
gap: 50px;
|
||||||
justify-content: space-between;
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main-gallery .categories ul li {
|
|
||||||
border: solid var(--color-dark-green);
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: var(--color-mid-green);
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-right: 35px;
|
|
||||||
min-width: 100%;
|
|
||||||
box-shadow: var(--shadow-strong);
|
|
||||||
}
|
|
||||||
|
|
||||||
#main-gallery .categories a {
|
|
||||||
color: var(--color-dark-green);
|
|
||||||
font-size: 1.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#cart-details {
|
|
||||||
background-color: var(--color-destin-sand);
|
|
||||||
border: solid var(--color-dark-green);
|
|
||||||
border-radius: 15px;
|
|
||||||
color: var(--color-dark-green);
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.4em;
|
|
||||||
text-align: center; /* Align text horizontally */
|
|
||||||
height: 30px; /* Adjust height to fit text comfortably */
|
|
||||||
padding: 0 15px; /* Horizontal padding for spacing */
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
box-shadow: var(--shadow-subtle);
|
|
||||||
transform: translateX(-15vw) translateY(-5vh);
|
|
||||||
transition: background-color 0.3s ease, color 0.3s ease;
|
|
||||||
display: flex; /* Flexbox ensures content alignment */
|
|
||||||
align-items: center; /* Center text vertically */
|
|
||||||
justify-content: center; /* Center text horizontally */
|
|
||||||
}
|
|
||||||
|
|
||||||
button#cart-details:hover {
|
|
||||||
background-color: var(--color-dark-green);
|
|
||||||
color: var(--color-destin-sand);
|
|
||||||
border: solid var(--color-destin-sand);
|
|
||||||
border-radius: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.product-card {
|
|
||||||
box-shadow: var(--shadow-subtle);
|
|
||||||
transition: background-color 0.3s ease, color 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-to-cart-btn {
|
.add-to-cart-btn {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: var(--color-destin-sand);
|
background-color: var(--color-mid-green);
|
||||||
border: solid var(--color-dark-green);
|
border: solid 1px var(--color-dark-green);
|
||||||
color: var(--color-dark-green);
|
color: var(--color-dark-green);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
@@ -173,10 +142,25 @@ button#cart-details:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.add-to-cart-btn:hover {
|
.add-to-cart-btn:hover {
|
||||||
background-color: var(--color-dark-green);
|
background-color: var(--color-destin-sand);
|
||||||
border: solid var(--color-destin-sand);
|
border: solid var(--color-dark-green);
|
||||||
color: var(--color-destin-sand);
|
color: var(--color-dark-green);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: var(--shadow-strong);
|
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 ↑-↑-↑--| */
|
/* |--↑-↑-↑ End gallery.html ↑-↑-↑--| */
|
Reference in New Issue
Block a user