Apply UI Authorization to Existing LiveViews closes #400 #403
1 changed files with 3 additions and 2 deletions
|
|
@ -97,12 +97,13 @@ defmodule MvWeb.CoreComponents do
|
|||
<.button navigate={~p"/"}>Home</.button>
|
||||
<.button disabled={true}>Disabled</.button>
|
||||
"""
|
||||
attr :rest, :global, include: ~w(href navigate patch method)
|
||||
attr :rest, :global, include: ~w(href navigate patch method data-testid)
|
||||
attr :variant, :string, values: ~w(primary)
|
||||
attr :disabled, :boolean, default: false, doc: "Whether the button is disabled"
|
||||
slot :inner_block, required: true
|
||||
|
||||
def button(%{rest: rest} = assigns) do
|
||||
def button(assigns) do
|
||||
rest = assigns.rest
|
||||
variants = %{"primary" => "btn-primary", nil => "btn-primary btn-soft"}
|
||||
assigns = assign(assigns, :class, Map.fetch!(variants, assigns[:variant]))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue