diff --git a/lib/pearl_web.ex b/lib/pearl_web.ex index 12a7eae..c5f2279 100644 --- a/lib/pearl_web.ex +++ b/lib/pearl_web.ex @@ -102,6 +102,7 @@ defmodule PearlWeb do layout: {PearlWeb.Layouts, :backoffice} import PearlWeb.Components.Avatar + import PearlWeb.Components.Button import PearlWeb.Components.EnsurePermissions import PearlWeb.BackofficeHelpers @@ -122,6 +123,7 @@ defmodule PearlWeb do quote do use Phoenix.LiveComponent import PearlWeb.Components.Avatar + import PearlWeb.Components.Button unquote(html_helpers()) end end diff --git a/lib/pearl_web/components/button.ex b/lib/pearl_web/components/button.ex index 6629bec..541bb6c 100644 --- a/lib/pearl_web/components/button.ex +++ b/lib/pearl_web/components/button.ex @@ -33,4 +33,109 @@ defmodule PearlWeb.Components.Button do """ end + + @doc """ + Renders a backoffice_button. + + ## Examples + + <.backoffice_button>Send! + <.backoffice_button phx-click="go" class="ml-2">Send! + """ + attr :type, :string, default: nil + attr :class, :string, default: nil + attr :rest, :global, include: ~w(disabled form name value) + + slot :inner_block, required: true + + def backoffice_button(assigns) do + ~H""" + + """ + end + + @doc """ + Renders a primary button with icon and title. + + ## Examples + + <.primary_button title="Continue" /> + <.primary_button title="Next" class="w-full" /> + <.primary_button small /> + """ + attr :title, :string, default: nil + attr :icon, :string, default: "hero-arrow-right" + attr :small, :boolean, default: false + attr :gap, :string, default: "gap-1.5" + attr :class, :string, default: nil + attr :rest, :global, include: ~w(disabled phx-click phx-disable-with phx-target) + + def primary_button(assigns) do + ~H""" + + """ + end + + @doc """ + Renders a secondary button with icon and title. + + ## Examples + + <.secondary_button title="Continue" /> + <.secondary_button title="Next" icon_position="left" /> + """ + attr :title, :string, required: true + attr :icon, :string, default: "hero-arrow-left" + attr :icon_position, :string, default: "right", values: ["left", "right"] + attr :gap, :string, default: "gap-1.5" + attr :class, :string, default: nil + attr :rest, :global, include: ~w(disabled phx-click phx-disable-with phx-target) + + def secondary_button(assigns) do + ~H""" + + """ + end end diff --git a/lib/pearl_web/components/core_components.ex b/lib/pearl_web/components/core_components.ex index fa839ac..16eaa71 100644 --- a/lib/pearl_web/components/core_components.ex +++ b/lib/pearl_web/components/core_components.ex @@ -188,7 +188,7 @@ defmodule PearlWeb.CoreComponents do <.input field={@form[:email]} label="Email"/> <.input field={@form[:username]} label="Username" /> <:actions> - <.button>Save + <.backoffice_button>Save """ @@ -216,36 +216,6 @@ defmodule PearlWeb.CoreComponents do """ end - @doc """ - Renders a button. - - ## Examples - - <.button>Send! - <.button phx-click="go" class="ml-2">Send! - """ - attr :type, :string, default: nil - attr :class, :string, default: nil - attr :rest, :global, include: ~w(disabled form name value) - - slot :inner_block, required: true - - def button(assigns) do - ~H""" - - """ - end - @doc """ Renders an input with label and error messages. diff --git a/lib/pearl_web/components/cv_upload.ex b/lib/pearl_web/components/cv_upload.ex index 63f1c5a..44ab0ea 100644 --- a/lib/pearl_web/components/cv_upload.ex +++ b/lib/pearl_web/components/cv_upload.ex @@ -47,7 +47,7 @@ defmodule PearlWeb.Components.CVUpload do <%= if @in_app do %> <.action_button title="Upload" phx-disable-with="Uploading..." /> <% else %> - <.button phx-disable-with="Uploading...">Upload + <.backoffice_button phx-disable-with="Uploading...">Upload <% end %> diff --git a/lib/pearl_web/live/app/badge_live/index.ex b/lib/pearl_web/live/app/badge_live/index.ex index 3edc2b4..d22b2d9 100644 --- a/lib/pearl_web/live/app/badge_live/index.ex +++ b/lib/pearl_web/live/app/badge_live/index.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.App.BadgeLive.Index do use PearlWeb, :app_view alias Pearl.Contest - import PearlWeb.Components.Badge + import PearlWeb.Components.{Button, Badge} @impl true def mount(_params, _session, socket) do diff --git a/lib/pearl_web/live/app/coin_flip_live/components/room.ex b/lib/pearl_web/live/app/coin_flip_live/components/room.ex index baec626..792a246 100644 --- a/lib/pearl_web/live/app/coin_flip_live/components/room.ex +++ b/lib/pearl_web/live/app/coin_flip_live/components/room.ex @@ -5,7 +5,7 @@ defmodule PearlWeb.App.CoinFlipLive.Components.Room do use PearlWeb, :component import PearlWeb.CoreComponents - import PearlWeb.Components.Avatar + import PearlWeb.Components.{Avatar, Button} attr :room, :map, required: true attr :current_user, :map, required: true @@ -104,7 +104,7 @@ defmodule PearlWeb.App.CoinFlipLive.Components.Room do
<% else %> - <.button + <.backoffice_button :if={@room.player1.user.id != @current_user.id} class="px-7 size-full rounded-none !bg-transparent !text-white" phx-click="join-room" @@ -112,15 +112,15 @@ defmodule PearlWeb.App.CoinFlipLive.Components.Room do disabled={@attendee_tokens < @room.bet} > <.icon name="hero-plus" class="size-12" /> - - <.button + + <.backoffice_button :if={@room.player1.user.id == @current_user.id} class="px-7 my-auto size-full rounded-none !bg-transparent !text-white" phx-click="delete-room" phx-value-room_id={@room.id} > <.icon name="hero-x-mark" class="size-12" /> - + <% end %> """ diff --git a/lib/pearl_web/live/app/credential_live/edit.ex b/lib/pearl_web/live/app/credential_live/edit.ex index f1d87fc..6c9b4b5 100644 --- a/lib/pearl_web/live/app/credential_live/edit.ex +++ b/lib/pearl_web/live/app/credential_live/edit.ex @@ -3,6 +3,8 @@ defmodule PearlWeb.App.CredentialLive.Edit do alias Pearl.Accounts + import PearlWeb.Components.Button + @impl true def mount(_params, _session, socket) do {:ok, socket} diff --git a/lib/pearl_web/live/app/credential_live/edit.html.heex b/lib/pearl_web/live/app/credential_live/edit.html.heex index d831b92..2449f95 100644 --- a/lib/pearl_web/live/app/credential_live/edit.html.heex +++ b/lib/pearl_web/live/app/credential_live/edit.html.heex @@ -17,9 +17,9 @@ "Make sure you allow the use of your camera on this browser and that it isn't being used elsewhere." )}

- <.button id="permission-button" type="button"> + <.backoffice_button id="permission-button" type="button"> {gettext("Request Permission")} - + diff --git a/lib/pearl_web/live/auth/components/user_profile_settings.html.heex b/lib/pearl_web/live/auth/components/user_profile_settings.html.heex index 3d5e0d8..3b34c31 100644 --- a/lib/pearl_web/live/auth/components/user_profile_settings.html.heex +++ b/lib/pearl_web/live/auth/components/user_profile_settings.html.heex @@ -86,9 +86,9 @@ <%= if @in_app? do %> <.action_button title="Save Profile" class="w-full" /> <% else %> - <.button class="w-full"> + <.backoffice_button class="w-full"> Save Profile - + <% end %> diff --git a/lib/pearl_web/live/auth/user_confirmation_instructions_live.ex b/lib/pearl_web/live/auth/user_confirmation_instructions_live.ex index e3539d7..ec2b93a 100644 --- a/lib/pearl_web/live/auth/user_confirmation_instructions_live.ex +++ b/lib/pearl_web/live/auth/user_confirmation_instructions_live.ex @@ -3,6 +3,8 @@ defmodule PearlWeb.UserConfirmationInstructionsLive do alias Pearl.Accounts + import PearlWeb.Components.Button + def render(assigns) do ~H"""
@@ -14,9 +16,9 @@ defmodule PearlWeb.UserConfirmationInstructionsLive do <.simple_form for={@form} id="resend_confirmation_form" phx-submit="send_instructions"> <.input field={@form[:email]} type="email" placeholder="Email" required /> <:actions> - <.button phx-disable-with="Sending..." class="w-full"> + <.backoffice_button phx-disable-with="Sending..." class="w-full"> Resend confirmation instructions - + diff --git a/lib/pearl_web/live/backoffice/attendee_live/index.ex b/lib/pearl_web/live/backoffice/attendee_live/index.ex index 60d553b..e63e7e6 100644 --- a/lib/pearl_web/live/backoffice/attendee_live/index.ex +++ b/lib/pearl_web/live/backoffice/attendee_live/index.ex @@ -2,8 +2,7 @@ defmodule PearlWeb.Backoffice.AttendeeLive.Index do alias Pearl.Accounts use PearlWeb, :backoffice_view - import PearlWeb.Components.Table - import PearlWeb.Components.TableSearch + import PearlWeb.Components.{Table, TableSearch, Button} on_mount {PearlWeb.StaffRoles, index: %{"attendees" => ["show"]}, edit: %{"attendees" => ["edit"]}} diff --git a/lib/pearl_web/live/backoffice/attendee_live/index.html.heex b/lib/pearl_web/live/backoffice/attendee_live/index.html.heex index e8b911e..d49fab6 100644 --- a/lib/pearl_web/live/backoffice/attendee_live/index.html.heex +++ b/lib/pearl_web/live/backoffice/attendee_live/index.html.heex @@ -6,21 +6,21 @@ user={@current_user} permissions={%{"attendees" => ["show_leaderboard"]}} > - <.button> + <.backoffice_button> <.icon name="hero-trophy" class="w-5 h-5" /> - + <.link patch={~p"/downloads/attendees"} target="_blank"> - <.button> + <.backoffice_button> <.icon name="hero-cloud-arrow-down" class="w-5 h-5" /> - + <.table_search id="attendees-table-name-search" diff --git a/lib/pearl_web/live/backoffice/attendee_live/ineligible_live/form_component.ex b/lib/pearl_web/live/backoffice/attendee_live/ineligible_live/form_component.ex index 01b2108..d9f3a07 100644 --- a/lib/pearl_web/live/backoffice/attendee_live/ineligible_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/attendee_live/ineligible_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.AttendeeLive.IneligibleLive.FormComponent do use PearlWeb, :live_component alias Pearl.Accounts - import PearlWeb.Components.Forms + import PearlWeb.Components.{Forms, Button} @impl true def render(assigns) do @@ -21,9 +21,9 @@ defmodule PearlWeb.Backoffice.AttendeeLive.IneligibleLive.FormComponent do > <.field field={@form[:ineligible]} label="Ineligible" type="switch" /> <:actions> - <.button phx-disable-with="Saving..."> + <.backoffice_button phx-disable-with="Saving..."> {gettext("Save Eligibility")} - + diff --git a/lib/pearl_web/live/backoffice/attendee_live/show.ex b/lib/pearl_web/live/backoffice/attendee_live/show.ex index acdd24c..6fa5f1e 100644 --- a/lib/pearl_web/live/backoffice/attendee_live/show.ex +++ b/lib/pearl_web/live/backoffice/attendee_live/show.ex @@ -3,6 +3,8 @@ defmodule PearlWeb.Backoffice.AttendeeLive.Show do alias Pearl.Accounts + import PearlWeb.Components.Button + on_mount {PearlWeb.StaffRoles, show: %{"attendees" => ["show"]}, edit: %{"attendees" => ["edit"]}} diff --git a/lib/pearl_web/live/backoffice/attendee_live/show.html.heex b/lib/pearl_web/live/backoffice/attendee_live/show.html.heex index c9ed332..ae946e6 100644 --- a/lib/pearl_web/live/backoffice/attendee_live/show.html.heex +++ b/lib/pearl_web/live/backoffice/attendee_live/show.html.heex @@ -3,24 +3,24 @@
<.ensure_permissions user={@current_user} permissions={%{"attendees" => ["edit"]}}> <.link patch={~p"/dashboard/attendees/#{@attendee.id}/edit/tokens"}> - <.button> + <.backoffice_button> <.icon name="hero-currency-euro" class="w-5 h-5" /> - + <.link patch={~p"/dashboard/attendees/#{@attendee.id}/edit/eligibility"}> - <.button> + <.backoffice_button> <.icon name="hero-shield-exclamation" class="w-5 h-5" /> - + <.link patch={~p"/dashboard/attendees/#{@attendee.id}/redeem"}> - <.button> + <.backoffice_button> <.icon name="hero-check-badge" class="w-5 h-5" /> - + - <.button> + <.backoffice_button> <.icon name="hero-flag" class="w-5 h-5" /> - +
diff --git a/lib/pearl_web/live/backoffice/attendee_live/tokens_live/form_component.ex b/lib/pearl_web/live/backoffice/attendee_live/tokens_live/form_component.ex index 1d41d86..5a3d1a4 100644 --- a/lib/pearl_web/live/backoffice/attendee_live/tokens_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/attendee_live/tokens_live/form_component.ex @@ -3,7 +3,7 @@ defmodule PearlWeb.Backoffice.AttendeeLive.TokensLive.FormComponent do alias Pearl.Accounts alias Pearl.Contest - import PearlWeb.Components.Forms + import PearlWeb.Components.{Forms, Button} @impl true def render(assigns) do @@ -32,9 +32,9 @@ defmodule PearlWeb.Backoffice.AttendeeLive.TokensLive.FormComponent do /> <.field field={assigns.form[:tokens]} type="number" value={0} label="Tokens" required /> <:actions> - <.button phx-disable-with="Saving..."> + <.backoffice_button phx-disable-with="Saving..."> {gettext("Save Tokens")} - + @@ -55,13 +55,18 @@ defmodule PearlWeb.Backoffice.AttendeeLive.TokensLive.FormComponent do
- <.button phx-click="save" phx-target={@myself} class="w-full"> + <.backoffice_button phx-click="save" phx-target={@myself} class="w-full"> {gettext("Confirm")} - - - <.button phx-click="cancel" phx-value="Remove" phx-target={@myself} class="w-full"> + + + <.backoffice_button + phx-click="cancel" + phx-value="Remove" + phx-target={@myself} + class="w-full" + > {gettext("Cancel")} - +
diff --git a/lib/pearl_web/live/backoffice/badge_live/category_live/form_component.ex b/lib/pearl_web/live/backoffice/badge_live/category_live/form_component.ex index 3966b1e..1e71a94 100644 --- a/lib/pearl_web/live/backoffice/badge_live/category_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/badge_live/category_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.CategoryLive.FormComponent do use PearlWeb, :live_component alias Pearl.Contest - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} @impl true def render(assigns) do @@ -38,7 +38,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.CategoryLive.FormComponent do /> <:actions> - <.button phx-disable-with="Saving...">Save Category + <.backoffice_button phx-disable-with="Saving...">Save Category diff --git a/lib/pearl_web/live/backoffice/badge_live/category_live/index.ex b/lib/pearl_web/live/backoffice/badge_live/category_live/index.ex index 541b1c0..49106fa 100644 --- a/lib/pearl_web/live/backoffice/badge_live/category_live/index.ex +++ b/lib/pearl_web/live/backoffice/badge_live/category_live/index.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.CategoryLive.Index do use PearlWeb, :live_component alias Pearl.Contest - import PearlWeb.Components.EnsurePermissions + import PearlWeb.Components.{Button, EnsurePermissions} @impl true def render(assigns) do @@ -12,7 +12,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.CategoryLive.Index do <:actions> <.ensure_permissions user={@current_user} permissions={%{"badges" => ["edit"]}}> <.link navigate={~p"/dashboard/badges/categories/new"}> - <.button>New Category + <.backoffice_button>New Category diff --git a/lib/pearl_web/live/backoffice/badge_live/condition_live/form_component.ex b/lib/pearl_web/live/backoffice/badge_live/condition_live/form_component.ex index dc286d0..c8d1f42 100644 --- a/lib/pearl_web/live/backoffice/badge_live/condition_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/badge_live/condition_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.ConditionLive.FormComponent do use PearlWeb, :live_component alias Pearl.Contest - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} @impl true def render(assigns) do @@ -73,7 +73,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.ConditionLive.FormComponent do <:actions> - <.button phx-disable-with="Saving...">Save Condition + <.backoffice_button phx-disable-with="Saving...">Save Condition diff --git a/lib/pearl_web/live/backoffice/badge_live/condition_live/index.ex b/lib/pearl_web/live/backoffice/badge_live/condition_live/index.ex index 8812090..63c0e3f 100644 --- a/lib/pearl_web/live/backoffice/badge_live/condition_live/index.ex +++ b/lib/pearl_web/live/backoffice/badge_live/condition_live/index.ex @@ -3,6 +3,8 @@ defmodule PearlWeb.Backoffice.BadgeLive.ConditionLive.Index do alias Pearl.Contest + import PearlWeb.Components.Button + @impl true def render(assigns) do ~H""" @@ -13,7 +15,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.ConditionLive.Index do > <:actions> <.link navigate={~p"/dashboard/badges/#{@badge.id}/conditions/new"}> - <.button>New Condition + <.backoffice_button>New Condition diff --git a/lib/pearl_web/live/backoffice/badge_live/form_component.ex b/lib/pearl_web/live/backoffice/badge_live/form_component.ex index d7421f1..8d58b82 100644 --- a/lib/pearl_web/live/backoffice/badge_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/badge_live/form_component.ex @@ -4,8 +4,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.FormComponent do alias Pearl.Contest alias Pearl.Uploaders.Badge - import PearlWeb.Components.ImageUploader - import PearlWeb.Components.Forms + import PearlWeb.Components.{Forms, Button, ImageUploader} @impl true def render(assigns) do @@ -21,19 +20,19 @@ defmodule PearlWeb.Backoffice.BadgeLive.FormComponent do > <:actions> <.link :if={@badge.id} patch={~p"/dashboard/badges/#{@badge.id}/triggers"}> - <.button> + <.backoffice_button> <.icon name="hero-bolt" /> - + <.link :if={@badge.id} patch={~p"/dashboard/badges/#{@badge.id}/conditions"}> - <.button> + <.backoffice_button> <.icon name="hero-check-circle" /> - + <.link :if={@badge.id} patch={~p"/dashboard/badges/#{@badge.id}/redeems"}> - <.button> + <.backoffice_button> <.icon name="hero-check-badge" /> - + <.simple_form @@ -99,7 +98,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.FormComponent do <:actions> - <.button phx-disable-with="Saving...">Save Badge + <.backoffice_button phx-disable-with="Saving...">Save Badge diff --git a/lib/pearl_web/live/backoffice/badge_live/index.html.heex b/lib/pearl_web/live/backoffice/badge_live/index.html.heex index 0d6528b..a87477b 100644 --- a/lib/pearl_web/live/backoffice/badge_live/index.html.heex +++ b/lib/pearl_web/live/backoffice/badge_live/index.html.heex @@ -10,20 +10,20 @@ /> <.ensure_permissions user={@current_user} permissions={%{"badges" => ["edit"]}}> <.link patch={~p"/dashboard/badges/new"}> - <.button>New Badge + <.backoffice_button>New Badge <.link patch={~p"/dashboard/badges/import"}> - <.button> + <.backoffice_button> <.icon name="hero-arrow-up-tray" class="w-5 h-5" /> - + <.ensure_permissions user={@current_user} permissions={%{"badges" => ["show"]}}> <.link patch={~p"/dashboard/badges/categories"}> - <.button> + <.backoffice_button> <.icon name="hero-tag" class="w-5 h-5" /> - + diff --git a/lib/pearl_web/live/backoffice/badge_live/trigger_live/form_component.ex b/lib/pearl_web/live/backoffice/badge_live/trigger_live/form_component.ex index c839f18..6b6120b 100644 --- a/lib/pearl_web/live/backoffice/badge_live/trigger_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/badge_live/trigger_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.TriggerLive.FormComponent do use PearlWeb, :live_component alias Pearl.Contest - import PearlWeb.Components.Forms + import PearlWeb.Components.{Forms, Button} @impl true def render(assigns) do @@ -39,7 +39,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.TriggerLive.FormComponent do <:actions> - <.button phx-disable-with="Saving...">Save Trigger + <.backoffice_button phx-disable-with="Saving...">Save Trigger diff --git a/lib/pearl_web/live/backoffice/badge_live/trigger_live/index.ex b/lib/pearl_web/live/backoffice/badge_live/trigger_live/index.ex index eedcab2..1abbc88 100644 --- a/lib/pearl_web/live/backoffice/badge_live/trigger_live/index.ex +++ b/lib/pearl_web/live/backoffice/badge_live/trigger_live/index.ex @@ -2,6 +2,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.TriggerLive.Index do use PearlWeb, :live_component alias Pearl.Contest + import PearlWeb.Components.Button @impl true def render(assigns) do @@ -10,7 +11,7 @@ defmodule PearlWeb.Backoffice.BadgeLive.TriggerLive.Index do <.page title={@title} subtitle={gettext("Attendee actions can trigger badge redeems.")}> <:actions> <.link navigate={~p"/dashboard/badges/#{@badge.id}/triggers/new"}> - <.button>New Trigger + <.backoffice_button>New Trigger diff --git a/lib/pearl_web/live/backoffice/challenge_live/form_component.ex b/lib/pearl_web/live/backoffice/challenge_live/form_component.ex index 38baccd..235c09e 100644 --- a/lib/pearl_web/live/backoffice/challenge_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/challenge_live/form_component.ex @@ -3,7 +3,7 @@ defmodule PearlWeb.ChallengeLive.FormComponent do alias Pearl.Challenges alias Pearl.Challenges.Challenge - import PearlWeb.Components.Forms + import PearlWeb.Components.{Forms, Button} @impl true def render(assigns) do @@ -81,7 +81,7 @@ defmodule PearlWeb.ChallengeLive.FormComponent do {gettext("New Prize")} - <.button phx-disable-with="Saving...">Save Challenge + <.backoffice_button phx-disable-with="Saving...">Save Challenge diff --git a/lib/pearl_web/live/backoffice/challenge_live/index.ex b/lib/pearl_web/live/backoffice/challenge_live/index.ex index 09791bc..3848d4d 100644 --- a/lib/pearl_web/live/backoffice/challenge_live/index.ex +++ b/lib/pearl_web/live/backoffice/challenge_live/index.ex @@ -8,8 +8,7 @@ defmodule PearlWeb.Backoffice.ChallengeLive.Index do alias PearlWeb.Helpers - import PearlWeb.Components.Table - import PearlWeb.Components.TableSearch + import PearlWeb.Components.{Button, TableSearch, Table} on_mount {PearlWeb.StaffRoles, index: %{"challenges" => ["show"]}, diff --git a/lib/pearl_web/live/backoffice/challenge_live/index.html.heex b/lib/pearl_web/live/backoffice/challenge_live/index.html.heex index 37d5886..48a5348 100644 --- a/lib/pearl_web/live/backoffice/challenge_live/index.html.heex +++ b/lib/pearl_web/live/backoffice/challenge_live/index.html.heex @@ -10,7 +10,7 @@ /> <.ensure_permissions user={@current_user} permissions={%{"challenges" => ["edit"]}}> <.link patch={~p"/dashboard/minigames/challenges/new"}> - <.button>New Challenge + <.backoffice_button>New Challenge diff --git a/lib/pearl_web/live/backoffice/companies_live/form_component.ex b/lib/pearl_web/live/backoffice/companies_live/form_component.ex index 9ff878d..0dbb25d 100644 --- a/lib/pearl_web/live/backoffice/companies_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/companies_live/form_component.ex @@ -5,7 +5,7 @@ defmodule PearlWeb.Backoffice.CompanyLive.FormComponent do alias Pearl.Uploaders.Company import PearlWeb.Components.ImageUploader - import PearlWeb.Components.Forms + import PearlWeb.Components.{ImageUploader, Forms, Button} @impl true def render(assigns) do @@ -96,7 +96,7 @@ defmodule PearlWeb.Backoffice.CompanyLive.FormComponent do <:actions> - <.button phx-disable-with="Saving...">Save Company + <.backoffice_button phx-disable-with="Saving...">Save Company diff --git a/lib/pearl_web/live/backoffice/companies_live/index.html.heex b/lib/pearl_web/live/backoffice/companies_live/index.html.heex index 9b3c9ba..d0237f4 100644 --- a/lib/pearl_web/live/backoffice/companies_live/index.html.heex +++ b/lib/pearl_web/live/backoffice/companies_live/index.html.heex @@ -10,15 +10,15 @@ /> <.ensure_permissions user={@current_user} permissions={%{"companies" => ["edit"]}}> <.link patch={~p"/dashboard/companies/new"}> - <.button>New Company + <.backoffice_button>New Company <.ensure_permissions user={@current_user} permissions={%{"companies" => ["edit"]}}> <.link patch={~p"/dashboard/companies/tiers"}> - <.button> + <.backoffice_button> <.icon name="hero-rectangle-stack" class="w-5 h-5" /> - + diff --git a/lib/pearl_web/live/backoffice/companies_live/tier_live/form_component.ex b/lib/pearl_web/live/backoffice/companies_live/tier_live/form_component.ex index 7e76dea..b53aaf3 100644 --- a/lib/pearl_web/live/backoffice/companies_live/tier_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/companies_live/tier_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.CompanyLive.TierLive.FormComponent do use PearlWeb, :live_component alias Pearl.Companies - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} @impl true def render(assigns) do @@ -24,7 +24,7 @@ defmodule PearlWeb.Backoffice.CompanyLive.TierLive.FormComponent do <.field field={@form[:full_cv_access]} type="switch" label="Full CV Access" /> <:actions> - <.button phx-disable-with="Saving...">Save Tier + <.backoffice_button phx-disable-with="Saving...">Save Tier diff --git a/lib/pearl_web/live/backoffice/companies_live/tier_live/index.ex b/lib/pearl_web/live/backoffice/companies_live/tier_live/index.ex index 3257732..be46691 100644 --- a/lib/pearl_web/live/backoffice/companies_live/tier_live/index.ex +++ b/lib/pearl_web/live/backoffice/companies_live/tier_live/index.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.CompanyLive.TierLive.Index do use PearlWeb, :live_component alias Pearl.Companies - import PearlWeb.Components.EnsurePermissions + import PearlWeb.Components.{EnsurePermissions, Button} @impl true def render(assigns) do @@ -12,7 +12,7 @@ defmodule PearlWeb.Backoffice.CompanyLive.TierLive.Index do <:actions> <.ensure_permissions user={@current_user} permissions={%{"companies" => ["edit"]}}> <.link navigate={~p"/dashboard/companies/tiers/new"}> - <.button>New Tier + <.backoffice_button>New Tier diff --git a/lib/pearl_web/live/backoffice/event_live/faq_live/form_component.ex b/lib/pearl_web/live/backoffice/event_live/faq_live/form_component.ex index 728757c..53c46e0 100644 --- a/lib/pearl_web/live/backoffice/event_live/faq_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/event_live/faq_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.EventLive.FaqLive.FormComponent do use PearlWeb, :live_component alias Pearl.Event - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} @impl true def render(assigns) do @@ -24,7 +24,7 @@ defmodule PearlWeb.Backoffice.EventLive.FaqLive.FormComponent do <.field field={@form[:answer]} type="textarea" required /> <:actions> - <.button phx-disable-with="Saving...">Save FAQ + <.backoffice_button phx-disable-with="Saving...">Save FAQ diff --git a/lib/pearl_web/live/backoffice/event_live/faq_live/index.ex b/lib/pearl_web/live/backoffice/event_live/faq_live/index.ex index c61e899..00595a1 100644 --- a/lib/pearl_web/live/backoffice/event_live/faq_live/index.ex +++ b/lib/pearl_web/live/backoffice/event_live/faq_live/index.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Backoffice.EventLive.FaqLive.Index do use PearlWeb, :live_component alias Pearl.Event - import PearlWeb.Components.EnsurePermissions + import PearlWeb.Components.{Button, EnsurePermissions} @impl true def render(assigns) do @@ -12,7 +12,7 @@ defmodule PearlWeb.Backoffice.EventLive.FaqLive.Index do <:actions> <.ensure_permissions user={@current_user} permissions={%{"event" => ["edit_faqs"]}}> <.link navigate={~p"/dashboard/event/faqs/new"}> - <.button>New FAQ + <.backoffice_button>New FAQ diff --git a/lib/pearl_web/live/backoffice/event_live/form_component.ex b/lib/pearl_web/live/backoffice/event_live/form_component.ex index a2f56c8..e36685b 100644 --- a/lib/pearl_web/live/backoffice/event_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/event_live/form_component.ex @@ -1,7 +1,7 @@ defmodule PearlWeb.Backoffice.EventLive.FormComponent do use PearlWeb, :live_component - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} alias Pearl.Event alias PearlWeb.Helpers @@ -51,12 +51,12 @@ defmodule PearlWeb.Backoffice.EventLive.FormComponent do <.field field={@form[:start_time]} type="datetime-local" label="Start Date/Time" required /> <:actions> - <.button + <.backoffice_button data-confirm="Do you want to save these changes? It can break stuff if you are not careful" phx-disable-with="Saving..." > {gettext("Save Settings")} - + diff --git a/lib/pearl_web/live/backoffice/event_live/generate_credentials_live/form_component.ex b/lib/pearl_web/live/backoffice/event_live/generate_credentials_live/form_component.ex index 89de58e..ffc7812 100644 --- a/lib/pearl_web/live/backoffice/event_live/generate_credentials_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/event_live/generate_credentials_live/form_component.ex @@ -1,7 +1,7 @@ defmodule PearlWeb.Backoffice.EventLive.GenerateCredentialsLive.FormComponent do use PearlWeb, :live_component - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} @impl true def render(assigns) do @@ -13,7 +13,7 @@ defmodule PearlWeb.Backoffice.EventLive.GenerateCredentialsLive.FormComponent do <.field field={@form[:count]} type="number" label="Number of Credentials" required /> <:actions> - <.button phx-disable-with="Generating...">Generate + <.backoffice_button phx-disable-with="Generating...">Generate diff --git a/lib/pearl_web/live/backoffice/event_live/index.ex b/lib/pearl_web/live/backoffice/event_live/index.ex index 522dc19..e0d1d62 100644 --- a/lib/pearl_web/live/backoffice/event_live/index.ex +++ b/lib/pearl_web/live/backoffice/event_live/index.ex @@ -5,6 +5,8 @@ defmodule PearlWeb.Backoffice.EventLive.Index do alias Pearl.Event.Faq alias Pearl.Teams + import PearlWeb.Components.Button + on_mount {PearlWeb.StaffRoles, show: %{"event" => ["show"]}, edit: %{"event" => ["edit"]}, diff --git a/lib/pearl_web/live/backoffice/event_live/index.html.heex b/lib/pearl_web/live/backoffice/event_live/index.html.heex index 9cb7bd0..1c49ab2 100644 --- a/lib/pearl_web/live/backoffice/event_live/index.html.heex +++ b/lib/pearl_web/live/backoffice/event_live/index.html.heex @@ -1,29 +1,29 @@ <.page title="Event Settings"> <:actions> <.link patch={~p"/dashboard/event/teams"}> - <.button> + <.backoffice_button> <.icon name="hero-user-group" class="w-5 h-5" /> - + <.link patch={~p"/dashboard/event/faqs"}> - <.button> + <.backoffice_button> <.icon name="hero-lifebuoy" class="w-5 h-5" /> - + <.link patch={~p"/dashboard/event/credentials"}> - <.button> + <.backoffice_button> <.icon name="hero-qr-code" class="w-5 h-5" /> - + <.link patch={~p"/dashboard/event/edit"}> - <.button>{gettext("Edit Settings")} + <.backoffice_button>{gettext("Edit Settings")} <.link href={~p"/downloads/cv_challenge"} target="_blank"> - <.button>{gettext("CV Challenge")} + <.backoffice_button>{gettext("CV Challenge")} <.link patch={~p"/downloads/final_draw"} target="_blank"> - <.button>{gettext("Export Final Draw CSV")} + <.backoffice_button>{gettext("Export Final Draw CSV")} diff --git a/lib/pearl_web/live/backoffice/event_live/teams_live/form_component.ex b/lib/pearl_web/live/backoffice/event_live/teams_live/form_component.ex index be72959..6ab0676 100644 --- a/lib/pearl_web/live/backoffice/event_live/teams_live/form_component.ex +++ b/lib/pearl_web/live/backoffice/event_live/teams_live/form_component.ex @@ -2,7 +2,7 @@ defmodule PearlWeb.Live.Backoffice.EventLive.TeamsLive.FormComponent do use PearlWeb, :live_component alias Pearl.Teams - import PearlWeb.Components.Forms + import PearlWeb.Components.{Button, Forms} @impl true def render(assigns) do @@ -14,9 +14,9 @@ defmodule PearlWeb.Live.Backoffice.EventLive.TeamsLive.FormComponent do :if={@action != :teams_new} navigate={~p"/dashboard/event/teams/#{@team.id}/edit/members"} > - <.button> + <.backoffice_button> {gettext("New Member")} - + <.simple_form for={@form} id="edit-team-form" phx-target={@myself} phx-submit="save"> @@ -56,7 +56,7 @@ defmodule PearlWeb.Live.Backoffice.EventLive.TeamsLive.FormComponent do <:actions> - <.button phx-disable-with="Saving...">Save Team + <.backoffice_button phx-disable-with="Saving...">Save Team diff --git a/lib/pearl_web/live/backoffice/event_live/teams_live/index.ex b/lib/pearl_web/live/backoffice/event_live/teams_live/index.ex index 5fcfea1..7e6288b 100644 --- a/lib/pearl_web/live/backoffice/event_live/teams_live/index.ex +++ b/lib/pearl_web/live/backoffice/event_live/teams_live/index.ex @@ -3,6 +3,8 @@ defmodule PearlWeb.Live.Backoffice.EventLive.TeamsLive.Index do alias Pearl.Teams + import PearlWeb.Components.Button + @impl true def render(assigns) do ~H""" @@ -10,7 +12,7 @@ defmodule PearlWeb.Live.Backoffice.EventLive.TeamsLive.Index do <.page title={@title}> <:actions> <.link navigate={~p"/dashboard/event/teams/new"}> - <.button>New Team + <.backoffice_button>New Team