wire simple pages to PageRenderer (stage 3)
Home, Content (about/delivery/privacy/terms), Contact, and ErrorHTML now render through the generic PageRenderer instead of hardcoded templates. Block wrapper divs enable CSS grid targeting. Featured products block supports layout/card_variant/columns settings for different page contexts. Contact page uses CSS grid on data-block-type attributes for two-column layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,9 @@ defmodule Berrypod.Pages do
|
||||
{:ok, page_data} -> page_data
|
||||
:miss -> get_page_uncached(slug)
|
||||
end
|
||||
rescue
|
||||
# ETS table might not exist yet during startup
|
||||
ArgumentError -> get_page_uncached(slug)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
@@ -22,6 +22,8 @@ defmodule Berrypod.Pages.BlockTypes do
|
||||
%{key: "description", label: "Description", type: :textarea, default: ""},
|
||||
%{key: "cta_text", label: "Button text", type: :text, default: ""},
|
||||
%{key: "cta_href", label: "Button link", type: :text, default: ""},
|
||||
%{key: "secondary_cta_text", label: "Secondary button text", type: :text, default: ""},
|
||||
%{key: "secondary_cta_href", label: "Secondary button link", type: :text, default: ""},
|
||||
%{
|
||||
key: "variant",
|
||||
label: "Style",
|
||||
@@ -37,7 +39,28 @@ defmodule Berrypod.Pages.BlockTypes do
|
||||
allowed_on: :all,
|
||||
settings_schema: [
|
||||
%{key: "title", label: "Title", type: :text, default: "Featured products"},
|
||||
%{key: "product_count", label: "Number of products", type: :number, default: 8}
|
||||
%{key: "product_count", label: "Number of products", type: :number, default: 8},
|
||||
%{
|
||||
key: "layout",
|
||||
label: "Layout",
|
||||
type: :select,
|
||||
options: ~w(section grid),
|
||||
default: "section"
|
||||
},
|
||||
%{
|
||||
key: "card_variant",
|
||||
label: "Card style",
|
||||
type: :select,
|
||||
options: ~w(featured default minimal compact),
|
||||
default: "featured"
|
||||
},
|
||||
%{
|
||||
key: "columns",
|
||||
label: "Columns",
|
||||
type: :select,
|
||||
options: ~w(auto fixed-4),
|
||||
default: "auto"
|
||||
}
|
||||
],
|
||||
data_loader: :load_featured_products
|
||||
},
|
||||
|
||||
@@ -65,12 +65,12 @@ defmodule Berrypod.Pages.Defaults do
|
||||
[
|
||||
block("hero", %{
|
||||
"title" => "About the studio",
|
||||
"description" => "",
|
||||
"description" => "Your story goes here \u2013 this is sample content for the demo shop",
|
||||
"variant" => "sunken"
|
||||
}),
|
||||
block("content_body", %{
|
||||
"image_src" => "/mockups/night-sky-blanket-3",
|
||||
"image_alt" => "Night sky blanket"
|
||||
"image_alt" => "Night sky blanket draped over a chair"
|
||||
})
|
||||
]
|
||||
end
|
||||
@@ -78,8 +78,8 @@ defmodule Berrypod.Pages.Defaults do
|
||||
defp blocks("delivery") do
|
||||
[
|
||||
block("hero", %{
|
||||
"title" => "Delivery information",
|
||||
"description" => "",
|
||||
"title" => "Delivery & returns",
|
||||
"description" => "Everything you need to know about shipping and returns",
|
||||
"variant" => "page"
|
||||
}),
|
||||
block("content_body")
|
||||
@@ -90,7 +90,7 @@ defmodule Berrypod.Pages.Defaults do
|
||||
[
|
||||
block("hero", %{
|
||||
"title" => "Privacy policy",
|
||||
"description" => "",
|
||||
"description" => "How we handle your personal information",
|
||||
"variant" => "page"
|
||||
}),
|
||||
block("content_body")
|
||||
@@ -100,8 +100,8 @@ defmodule Berrypod.Pages.Defaults do
|
||||
defp blocks("terms") do
|
||||
[
|
||||
block("hero", %{
|
||||
"title" => "Terms & conditions",
|
||||
"description" => "",
|
||||
"title" => "Terms of service",
|
||||
"description" => "The legal bits",
|
||||
"variant" => "page"
|
||||
}),
|
||||
block("content_body")
|
||||
@@ -186,11 +186,16 @@ defmodule Berrypod.Pages.Defaults do
|
||||
block("hero", %{
|
||||
"variant" => "error",
|
||||
"cta_text" => "Go to Homepage",
|
||||
"cta_href" => "/"
|
||||
"cta_href" => "/",
|
||||
"secondary_cta_text" => "Browse Products",
|
||||
"secondary_cta_href" => "/collections/all"
|
||||
}),
|
||||
block("featured_products", %{
|
||||
"title" => "Featured products",
|
||||
"product_count" => 4
|
||||
"product_count" => 4,
|
||||
"layout" => "grid",
|
||||
"card_variant" => "minimal",
|
||||
"columns" => "fixed-4"
|
||||
})
|
||||
]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user