refactor: extract remaining PDP components to ShopComponents
Add PDP-specific components: - product_gallery with lightbox - product_info (title, price, sale badge) - variant_selector - quantity_selector - add_to_cart_button - product_details accordion - star_rating - trust_badges - reviews_section with review_card Add page layout components: - page_title for consistent h1 styling - cart_layout for cart page structure - rich_text for structured content blocks - accordion_item for generic collapsible sections Update preview pages to be fully component-based: - PDP: 415 → 48 lines (88% reduction) - Cart: 47 → 23 lines - About: 65 → 27 lines Add preview data functions: - reviews() for product reviews - about_content() for rich text blocks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,50 @@ defmodule SimpleshopTheme.Theme.PreviewData do
|
||||
mock_testimonials()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns product reviews for preview.
|
||||
|
||||
Always returns mock data formatted for the reviews_section component.
|
||||
"""
|
||||
def reviews do
|
||||
[
|
||||
%{
|
||||
rating: 5,
|
||||
title: "Absolutely beautiful",
|
||||
body: "The quality exceeded my expectations. The colours are vibrant and the paper feels premium. It's now pride of place in my living room.",
|
||||
author: "Sarah M.",
|
||||
date: "2 weeks ago",
|
||||
verified: true
|
||||
},
|
||||
%{
|
||||
rating: 4,
|
||||
title: "Great gift",
|
||||
body: "Bought this as a gift and it arrived beautifully packaged. Fast shipping too. Would definitely order again.",
|
||||
author: "James T.",
|
||||
date: "1 month ago",
|
||||
verified: true
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns about page content for preview.
|
||||
|
||||
Returns structured content blocks for the rich_text component.
|
||||
"""
|
||||
def about_content do
|
||||
[
|
||||
%{type: :lead, text: "I'm Emma, a nature photographer based in the UK. What started as weekend walks with my camera has grown into something I never expected – a little shop where I can share my favourite captures with others."},
|
||||
%{type: :paragraph, text: "Every design in this shop comes from my own photography. Whether it's early morning mist over the hills, autumn leaves in the local woods, or the quiet beauty of wildflower meadows, I'm drawn to the peaceful moments that nature offers."},
|
||||
%{type: :paragraph, text: "I work with quality print partners to bring these images to life on products you can actually use and enjoy – from art prints for your walls to mugs for your morning tea."},
|
||||
%{type: :heading, text: "Quality you can trust"},
|
||||
%{type: :paragraph, text: "I've carefully chosen print partners who share my commitment to quality. Every product is made to order using premium materials and printing techniques that ensure vibrant colours and lasting quality."},
|
||||
%{type: :heading, text: "Printed sustainably"},
|
||||
%{type: :paragraph, text: "Because each item is printed on demand, there's no waste from unsold stock. My print partners use eco-friendly inks where possible, and products are shipped directly to you to minimise unnecessary handling."},
|
||||
%{type: :closing, text: "Thank you for visiting. It means a lot that you're here."}
|
||||
]
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns categories for preview.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user