feat: add About page to public storefront
- Create ShopLive.About module and template - Add /about route to public shop live session - Reuse shop_components for header, footer, hero, rich text Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
75206474a1
commit
1f8dbd645d
34
lib/simpleshop_theme_web/live/shop_live/about.ex
Normal file
34
lib/simpleshop_theme_web/live/shop_live/about.ex
Normal file
@ -0,0 +1,34 @@
|
||||
defmodule SimpleshopThemeWeb.ShopLive.About do
|
||||
use SimpleshopThemeWeb, :live_view
|
||||
|
||||
alias SimpleshopTheme.Settings
|
||||
alias SimpleshopTheme.Media
|
||||
alias SimpleshopTheme.Theme.{CSSCache, CSSGenerator, PreviewData}
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
theme_settings = Settings.get_theme_settings()
|
||||
|
||||
generated_css =
|
||||
case CSSCache.get() do
|
||||
{:ok, css} -> css
|
||||
:miss ->
|
||||
css = CSSGenerator.generate(theme_settings)
|
||||
CSSCache.put(css)
|
||||
css
|
||||
end
|
||||
|
||||
logo_image = Media.get_logo()
|
||||
header_image = Media.get_header()
|
||||
|
||||
socket =
|
||||
socket
|
||||
|> assign(:page_title, "About")
|
||||
|> assign(:theme_settings, theme_settings)
|
||||
|> assign(:generated_css, generated_css)
|
||||
|> assign(:logo_image, logo_image)
|
||||
|> assign(:header_image, header_image)
|
||||
|
||||
{:ok, socket}
|
||||
end
|
||||
end
|
||||
27
lib/simpleshop_theme_web/live/shop_live/about.html.heex
Normal file
27
lib/simpleshop_theme_web/live/shop_live/about.html.heex
Normal file
@ -0,0 +1,27 @@
|
||||
<div class="shop-container min-h-screen" style="background-color: var(--t-surface-base); font-family: var(--t-font-body); color: var(--t-text-primary);">
|
||||
<.skip_link />
|
||||
|
||||
<%= if @theme_settings.announcement_bar do %>
|
||||
<.announcement_bar theme_settings={@theme_settings} />
|
||||
<% end %>
|
||||
|
||||
<.shop_header theme_settings={@theme_settings} logo_image={@logo_image} header_image={@header_image} active_page="about" mode={:shop} cart_count={0} />
|
||||
|
||||
<main id="main-content" class="content-page" style="background-color: var(--t-surface-base);">
|
||||
<.hero_section
|
||||
title="About the studio"
|
||||
description="Nature photography, printed with care"
|
||||
background={:sunken}
|
||||
/>
|
||||
|
||||
<.content_body image_url="/mockups/night-sky-blanket-3.jpg">
|
||||
<.rich_text blocks={SimpleshopTheme.Theme.PreviewData.about_content()} />
|
||||
</.content_body>
|
||||
</main>
|
||||
|
||||
<.shop_footer theme_settings={@theme_settings} mode={:shop} />
|
||||
|
||||
<.cart_drawer cart_items={[]} subtotal="£0.00" mode={:shop} />
|
||||
|
||||
<.search_modal hint_text={~s(Try searching for "mountain", "forest", or "ocean")} />
|
||||
</div>
|
||||
@ -27,6 +27,7 @@ defmodule SimpleshopThemeWeb.Router do
|
||||
|
||||
live_session :public_shop, layout: {SimpleshopThemeWeb.Layouts, :shop} do
|
||||
live "/", ShopLive.Home, :index
|
||||
live "/about", ShopLive.About, :index
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user