defmodule SpazioSolazzoWeb.LandingComponents do
@moduledoc """
Reusable components for landing pages (coworking, meeting room, music room).
"""
use Phoenix.Component
import SpazioSolazzoWeb.CoreComponents, only: [icon: 1, back_to_link: 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("primary"), do: "bg-primary/10 text-primary"
defp color_classes("secondary"), do: "bg-secondary/10 text-secondary"
defp color_classes("accent"), do: "bg-accent/10 text-accent"
defp color_classes("sky"), do: "bg-secondary/10 text-secondary"
defp color_classes("orange"), do: "bg-primary/10 text-primary"
defp color_classes("yellow"), do: "bg-accent/10 text-accent"
defp color_classes("emerald"), do: "bg-success/10 text-success"
defp color_classes("indigo"), do: "bg-info/10 text-info"
defp color_classes("purple"), do: "bg-primary/10 text-primary"
defp color_classes(_), do: "bg-neutral/10 text-neutral"
@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-secondary 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}"}
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 :capacity, :string, required: true
attr :images, :list, default: []
def page_header(assigns) do
~H"""
<.back_to_link
navigate={~p"/"}
value="Back to Home"
/>
{render_slot(@title)}
{render_slot(@description)}
<.link
navigate={@booking_path}
class="btn btn-primary h-14 px-8 rounded-2xl text-lg font-bold shadow-xl hover:-translate-y-1"
>
{@booking_label}
<.icon name="hero-arrow-right" class="w-5 h-5" />
<.live_component
module={SpazioSolazzoWeb.CarouselLiveComponent}
id="page-header-carousel"
images={@images}
height="100%"
/>
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, "primary")}
/>
"""
end
end