feat: add Contact page to public storefront
- Create ShopLive.Contact module and template - Add /contact route to public shop live session - Includes contact form, order tracking, info cards, social links Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1f8dbd645d
commit
5ceff20aaa
34
lib/simpleshop_theme_web/live/shop_live/contact.ex
Normal file
34
lib/simpleshop_theme_web/live/shop_live/contact.ex
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
defmodule SimpleshopThemeWeb.ShopLive.Contact do
|
||||||
|
use SimpleshopThemeWeb, :live_view
|
||||||
|
|
||||||
|
alias SimpleshopTheme.Settings
|
||||||
|
alias SimpleshopTheme.Media
|
||||||
|
alias SimpleshopTheme.Theme.{CSSCache, CSSGenerator}
|
||||||
|
|
||||||
|
@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, "Contact")
|
||||||
|
|> assign(:theme_settings, theme_settings)
|
||||||
|
|> assign(:generated_css, generated_css)
|
||||||
|
|> assign(:logo_image, logo_image)
|
||||||
|
|> assign(:header_image, header_image)
|
||||||
|
|
||||||
|
{:ok, socket}
|
||||||
|
end
|
||||||
|
end
|
||||||
41
lib/simpleshop_theme_web/live/shop_live/contact.html.heex
Normal file
41
lib/simpleshop_theme_web/live/shop_live/contact.html.heex
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<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="contact" mode={:shop} cart_count={0} />
|
||||||
|
|
||||||
|
<main id="main-content" class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
|
||||||
|
<.hero_section
|
||||||
|
variant={:page}
|
||||||
|
title="Contact Us"
|
||||||
|
description="Questions about your order or just want to say hello? Drop us a message and we'll get back to you as soon as we can."
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="grid gap-8 md:grid-cols-2 mb-12">
|
||||||
|
<.contact_form />
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
<.order_tracking_card />
|
||||||
|
|
||||||
|
<.info_card title="Handy to know" items={[
|
||||||
|
%{label: "Printing", value: "2-5 business days"},
|
||||||
|
%{label: "Delivery", value: "3-7 business days after printing"},
|
||||||
|
%{label: "Returns", value: "Happy to help with faulty or damaged items"}
|
||||||
|
]} />
|
||||||
|
|
||||||
|
<.contact_info_card email="hello@example.com" />
|
||||||
|
|
||||||
|
<.social_links />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
@ -28,6 +28,7 @@ defmodule SimpleshopThemeWeb.Router do
|
|||||||
live_session :public_shop, layout: {SimpleshopThemeWeb.Layouts, :shop} do
|
live_session :public_shop, layout: {SimpleshopThemeWeb.Layouts, :shop} do
|
||||||
live "/", ShopLive.Home, :index
|
live "/", ShopLive.Home, :index
|
||||||
live "/about", ShopLive.About, :index
|
live "/about", ShopLive.About, :index
|
||||||
|
live "/contact", ShopLive.Contact, :index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user