diff options
Diffstat (limited to 'lib/nola_web/components/event_component.ex')
-rw-r--r-- | lib/nola_web/components/event_component.ex | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/nola_web/components/event_component.ex b/lib/nola_web/components/event_component.ex new file mode 100644 index 0000000..8af3c67 --- /dev/null +++ b/lib/nola_web/components/event_component.ex @@ -0,0 +1,43 @@ +defmodule NolaWeb.EventComponent do + use Phoenix.Component + + def content(assigns = %{event: %{type: :day_changed}}) do + ~H""" + Day changed: + <span class="reason"><%= Date.to_string(@date) %></span> + """ + end + + def content(assigns = %{event: %{type: :quit}}) do + ~H""" + <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} /> + has quit: + <span class="reason"><%= @reason %></span> + """ + end + + def content(assigns = %{event: %{type: :part}}) do + ~H""" + <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} /> + has left: + <span class="reason"><%= @reason %></span> + """ + end + + def content(assigns = %{event: %{type: :nick}}) do + ~H""" + <span class="old-nick"><%= @old_nick %></span> + is now known as + <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} /> + """ + end + + def content(assigns = %{event: %{type: :join}}) do + ~H""" + <NolaWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} /> + joined + """ + end + + +end |