Style secrets modal consistently with other add modals

This commit is contained in:
José Valim 2022-09-01 08:09:27 +02:00
parent 07afde0f77
commit 31c6f7adf7
3 changed files with 49 additions and 52 deletions

View file

@ -405,6 +405,7 @@ defmodule LivebookWeb.SessionLive do
id="secrets"
session={@session}
secret={@secret}
return_to={@self_path}
/>
</.modal>
<% end %>

View file

@ -1,12 +1,6 @@
defmodule LivebookWeb.SessionLive.SecretsComponent do
use LivebookWeb, :live_component
@impl true
def update(assigns, socket) do
socket = assign(socket, assigns)
{:ok, socket}
end
@impl true
def render(assigns) do
~H"""
@ -14,48 +8,49 @@ defmodule LivebookWeb.SessionLive.SecretsComponent do
<h3 class="text-2xl font-semibold text-gray-800">
Add secret
</h3>
<div class="flex-col space-y-5">
<p class="text-gray-700" id="import-from-url">
Enter the secret name and its value.
</p>
<.form
let={f}
for={:secret}
phx-submit="save"
phx-change="validate"
autocomplete="off"
phx-target={@myself}
>
<div class="flex flex-col space-y-4">
<div>
<div class="input-label">
Label <span class="text-xs text-gray-500">(alphanumeric and underscore)</span>
</div>
<%= text_input(f, :label,
value: @secret["label"],
class: "input",
placeholder: "secret label",
autofocus: true,
aria_labelledby: "secret-label",
spellcheck: "false"
) %>
</div>
<div>
<div class="input-label">Value</div>
<%= text_input(f, :value,
value: @secret["value"],
class: "input",
placeholder: "secret value",
aria_labelledby: "secret-value",
spellcheck: "false"
) %>
<p class="text-gray-700" id="import-from-url">
Enter the secret name and its value.
</p>
<.form
let={f}
for={:secret}
phx-submit="save"
phx-change="validate"
autocomplete="off"
phx-target={@myself}
>
<div class="flex flex-col space-y-4">
<div>
<div class="input-label">
Label <span class="text-xs text-gray-500">(alphanumeric and underscore)</span>
</div>
<%= text_input(f, :label,
value: @secret["label"],
class: "input",
placeholder: "secret label",
autofocus: true,
aria_labelledby: "secret-label",
spellcheck: "false"
) %>
</div>
<button class="mt-5 button-base button-blue" type="submit" disabled={not valid?(@secret)}>
Save
</button>
</.form>
</div>
<div>
<div class="input-label">Value</div>
<%= text_input(f, :value,
value: @secret["value"],
class: "input",
placeholder: "secret value",
aria_labelledby: "secret-value",
spellcheck: "false"
) %>
</div>
<div class="flex space-x-2">
<button class="button-base button-blue" type="submit" disabled={not valid?(@secret)}>
Save
</button>
<%= live_patch("Cancel", to: @return_to, class: "button-base button-outlined-gray") %>
</div>
</div>
</.form>
</div>
"""
end

View file

@ -63,12 +63,13 @@ defmodule LivebookWeb.SettingsLive.AddFileSystemComponent do
) %>
</.with_password_toggle>
</div>
</div>
<div class="mt-5 flex space-x-2">
<button class="button-base button-blue" type="submit" disabled={not data_valid?(@data)}>
Add
</button>
<%= live_patch("Cancel", to: @return_to, class: "button-base button-outlined-gray") %>
<div class="flex space-x-2">
<button class="button-base button-blue" type="submit" disabled={not data_valid?(@data)}>
Add
</button>
<%= live_patch("Cancel", to: @return_to, class: "button-base button-outlined-gray") %>
</div>
</div>
</.form>
</div>