Skip to content

Commit

Permalink
feat: dynamic event dates
Browse files Browse the repository at this point in the history
  • Loading branch information
joaodiaslobo committed Nov 6, 2024
1 parent 80090d4 commit 710b161
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
extend: {
colors: {
primary: "#04041C",
accent: "#ff800d",
accent: "#ffdb0d",
light: "#ffffff",
lightMuted: "#a1a1aa",
lightShade: "#e5e7eb",
Expand Down
15 changes: 11 additions & 4 deletions lib/safira_web/live/landing/home_live/components/hero.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ defmodule SafiraWeb.Landing.HomeLive.Components.Hero do

import SafiraWeb.Landing.Components.{JoinUs, Socials}

attr :event_start_date, Date, required: true
attr :event_end_date, Date, required: true

def hero(assigns) do
~H"""
<div class="mt-2">
<div class="select-none">
<div class="py-14 sm:py-28">
<.title />
<.title event_start_date={@event_start_date} event_end_date={@event_end_date} />
</div>
<div class="relative mt-24 text-white">
<div class="flex items-center justify-between pb-4">
Expand All @@ -33,11 +36,11 @@ defmodule SafiraWeb.Landing.HomeLive.Components.Hero do
"""
end

def title(assigns) do
defp title(assigns) do
~H"""
<div class="relative z-20 font-bold">
<h5 class="font-terminal uppercase m-1 text-2xl text-accent">
11-14 February 2025
<%= display_event_dates(@event_start_date, @event_end_date) %>
</h5>
<h1 class="font-terminal uppercase relative z-20 w-11/12 text-white text-5xl xs:text-5xl sm:text-6xl md:w-full md:text-7xl lg:text-8xl 2xl:w-5/6 2xl:text-8xl 2xl:leading-[5rem]">
<span class="relative z-20">
Expand All @@ -50,7 +53,7 @@ defmodule SafiraWeb.Landing.HomeLive.Components.Hero do
"""
end

def organization(assigns) do
defp organization(assigns) do
~H"""
<div class="flex flex-col gap-3">
<h5 class="font-imedium text-white"><%= gettext("Organization") %></h5>
Expand All @@ -60,4 +63,8 @@ defmodule SafiraWeb.Landing.HomeLive.Components.Hero do
</div>
"""
end

defp display_event_dates(event_start_date, event_end_date) do
"#{Timex.format!(event_start_date, "{D}")}-#{Timex.format!(event_end_date, "{D} {Mfull} {YYYY}")}"
end
end
8 changes: 7 additions & 1 deletion lib/safira_web/live/landing/home_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ defmodule SafiraWeb.Landing.HomeLive.Index do

import SafiraWeb.Landing.HomeLive.Components.{Hero, Partners, Pitch, Sponsors}

alias Safira.Event

@impl true
def mount(_params, _session, socket) do
{:ok, socket |> assign(:tiers, Companies.list_tiers_with_companies())}
{:ok,
socket
|> assign(:tiers, Companies.list_tiers_with_companies())
|> assign(:event_start_date, Event.get_event_start_date())
|> assign(:event_end_date, Event.get_event_end_date())}
end
end
2 changes: 1 addition & 1 deletion lib/safira_web/live/landing/home_live/index.html.heex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<.hero />
<.hero event_start_date={@event_start_date} event_end_date={@event_end_date} />
<.pitch />
<.sponsors tiers={@tiers} />
<.partners />

0 comments on commit 710b161

Please sign in to comment.