Browse Source

fix: improve forms

main
Inhji Y. 7 months ago
parent
commit
b16a070d46
  1. 21
      assets/css/_forms.scss
  2. 6
      assets/css/app.scss
  3. 9
      lib/mirage_web/live/link_live/form_component.html.leex
  4. 16
      lib/mirage_web/live/list_live/form_component.html.leex
  5. 2
      lib/mirage_web/live/note_live/form_component.html.leex
  6. 2
      lib/mirage_web/live/note_live/show.ex

21
assets/css/_forms.scss

@ -11,10 +11,6 @@
float: right;
font-size: 2rem;
}
form {
clear: both;
}
}
form {
@ -28,23 +24,30 @@ form {
margin-bottom: 0;
}
.tagify {
@include color-assign(border-color, surface-var);
}
#editor {
border: none;
}
select,
input[type=text],
input[type=url],
input[type=email],
input[type=password] {
@include color-assign(background-color, surface);
@include color-assign(color, on-surface);
border: none;
border-bottom: 1px solid white;
@include color-assign(border-color, on-surface);
border: 1px solid white;
@include color-assign(border-color, surface-var);
margin-bottom: 1rem;
padding: 0.5rem;
padding: 0.5rem 0.75rem;
width: 100%;
border-radius: 0;
font-size: 1rem;
&:last-child {
margin-bottom: 0;

6
assets/css/app.scss

@ -201,12 +201,6 @@ header.hero {
}
}
#editor {
border: 1px solid white;
@include color-assign(border-color, on-surface);
margin-bottom: 2rem;
}
.buttons {
margin-top: 2rem;
}

9
lib/mirage_web/live/link_live/form_component.html.leex

@ -1,5 +1,3 @@
<h2><%= @title %></h2>
<%= f = form_for @changeset, "#",
id: "link-form",
phx_target: @myself,
@ -8,19 +6,16 @@
phx_hook: "LinkForm" %>
<fieldset>
<%= label f, :title %>
<%= text_input f, :title %>
<%= text_input f, :title, placeholder: "Title" %>
<%= error_tag f, :title %>
</fieldset>
<fieldset>
<%= label f, :url %>
<%= text_input f, :url %>
<%= text_input f, :url, placeholder: "URL" %>
<%= error_tag f, :url %>
</fieldset>
<fieldset>
<%= label f, :domain %>
<%= text_input f, :domain, readonly: true %>
<%= error_tag f, :domain %>
</fieldset>

16
lib/mirage_web/live/list_live/form_component.html.leex

@ -1,18 +1,18 @@
<h2><%= @title %></h2>
<%= f = form_for @changeset, "#",
id: "list-form",
phx_target: @myself,
phx_change: "validate",
phx_submit: "save" %>
<%= label f, :name %>
<%= text_input f, :name %>
<%= error_tag f, :name %>
<fieldset>
<%= text_input f, :name %>
<%= error_tag f, :name %>
</fieldset>
<%= label f, :is_public %>
<%= checkbox f, :is_public %>
<%= error_tag f, :is_public %>
<fieldset>
<%= checkbox f, :is_public %>
<%= error_tag f, :is_public %>
</fieldset>
<%= submit "Save", phx_disable_with: "Saving..." %>
</form>

2
lib/mirage_web/live/note_live/form_component.html.leex

@ -1,5 +1,3 @@
<h2><%= @title %></h2>
<%= f = form_for @changeset, "#",
id: "note-form",
phx_target: @myself,

2
lib/mirage_web/live/note_live/show.ex

@ -10,7 +10,7 @@ defmodule MirageWeb.NoteLive.Show do
alias Mirage.Links.Link
defp page_title(:show, note), do: note.title
defp page_title(:edit, note), do: "[Edit] #{note.title}"
defp page_title(:edit, note), do: "Edit Note"
@impl true
def mount(_params, session, socket) do

Loading…
Cancel
Save