defmodule SpazioSolazzoWeb.LandingComponents do
@moduledoc """
Reusable components for landing pages (coworking, meeting room, music room).
"""
use Phoenix.Component
import SpazioSolazzoWeb.CoreComponents, only: [icon: 1]
import Phoenix.Component
use Phoenix.VerifiedRoutes,
endpoint: SpazioSolazzoWeb.Endpoint,
router: SpazioSolazzoWeb.Router,
statics: SpazioSolazzoWeb.static_paths()
@doc """
Renders a feature card with icon, title, and description.
## Examples
<.feature_card
icon="tv"
title="4K Presentation"
description="Crystal clear 65" monitor ready for your slide decks."
color="sky"
/>
"""
attr :icon, :string, required: true
attr :title, :string, required: true
attr :description, :string, required: true
attr :color, :string,
default: "sky",
doc: "Color scheme: sky, orange, yellow, emerald, indigo, purple"
def feature_card(assigns) do
~H"""
<.icon name={@icon} class="w-7 h-7" />
{@title}
{@description}
"""
end
defp color_classes("sky"), do: "bg-sky-100 dark:bg-sky-900/30 text-sky-600 dark:text-sky-400"
defp color_classes("orange"),
do: "bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400"
defp color_classes("yellow"),
do: "bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-400"
defp color_classes("emerald"),
do: "bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400"
defp color_classes("indigo"),
do: "bg-indigo-100 dark:bg-indigo-900/30 text-indigo-600 dark:text-indigo-400"
defp color_classes("purple"),
do: "bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400"
defp color_classes(_),
do: "bg-slate-100 dark:bg-slate-900/30 text-slate-600 dark:text-slate-400"
@doc """
Renders a house rules section with a list of rules.
## Examples
<.house_rules title="House Rules">
<:rule>Please clean the whiteboard after use.
<:rule>Outside food is allowed, but please be tidy.
"""
attr :title, :string, default: "House Rules"
slot :rule, required: true
def house_rules(assigns) do
~H"""
{@title}
-
<.icon
name="hero-check-circle"
class="w-5 h-5 text-orange-500 dark:text-orange-400 shrink-0 mt-0.5"
/>
{render_slot(rule)}
"""
end
@doc """
Renders a page header with title, description, booking button, carousel, and capacity info.
## Examples
<.page_header
title="Meeting Room"
description="A private, sun-drenched sanctuary designed for focus and collaboration."
booking_path={~p"/book/asset/\#{@asset.id}"}
price="€40"
price_unit="hour"
capacity="Up to 8 People"
images={@images}
/>
"""
slot :title, required: true
slot :description, required: true
attr :booking_path, :string, required: true
attr :booking_label, :string, default: "Book This Room"
attr :price, :string, required: true
attr :price_unit, :string, default: "hour"
attr :capacity, :string, required: true
attr :images, :list, default: []
def page_header(assigns) do
~H"""
<.link
navigate={~p"/"}
class="hover:text-sky-500 dark:hover:text-yellow-400 transition-colors flex items-center gap-1"
>
<.icon name="hero-arrow-left" class="w-4 h-4" /> Back to Home
{render_slot(@title)}
{render_slot(@description)}
<.link
navigate={@booking_path}
class="h-14 px-8 rounded-2xl bg-sky-500 hover:bg-sky-600 dark:bg-teal-500 dark:hover:bg-teal-600 text-white text-lg font-bold transition-all shadow-xl shadow-sky-500/30 dark:shadow-teal-500/30 flex items-center justify-center gap-3 w-full sm:w-auto hover:-translate-y-1"
>
{@booking_label}
<.icon name="hero-arrow-right" class="w-5 h-5" />
{@price}
/ {@price_unit}
<.live_component
module={SpazioSolazzoWeb.CarouselLiveComponent}
id="page-header-carousel"
images={@images}
/>
CAPACITY
<.icon name="hero-user-group" class="w-6 h-6" />
{@capacity}
"""
end
@doc """
Renders an amenities/features section with a grid of feature cards.
## Examples
<.features_section title="Everything you need" description="Top-tier amenities...">
<:feature icon="tv" title="4K Presentation" description="..." color="sky" />
<:feature icon="video-camera" title="Video Conferencing" description="..." color="orange" />
"""
attr :title, :string, required: true
attr :description, :string, required: true
slot :feature, required: true do
attr :icon, :string, required: true
attr :title, :string, required: true
attr :description, :string, required: true
attr :color, :string
end
def features_section(assigns) do
~H"""
<.feature_card
:for={feature <- @feature}
icon={feature.icon}
title={feature.title}
description={feature.description}
color={Map.get(feature, :color, "sky")}
/>
"""
end
end