Make key bindings select consistent with UI (#2206)

This commit is contained in:
José Valim 2023-09-16 11:39:15 +02:00 committed by GitHub
parent 8633c9a357
commit 998d8e83f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

View file

@ -408,6 +408,7 @@ defmodule LivebookWeb.FormComponents do
attr :label, :string, default: nil
attr :value, :any
attr :errors, :list, default: []
attr :class, :string, default: ""
attr :field, Phoenix.HTML.FormField, doc: "a form field struct retrieved from the form"
attr :help, :string, default: nil
@ -421,7 +422,7 @@ defmodule LivebookWeb.FormComponents do
~H"""
<.field_wrapper id={@id} name={@name} label={@label} errors={@errors} help={@help}>
<select id={@id} name={@name} class="input" {@rest}>
<select id={@id} name={@name} class={["input", @class]} {@rest}>
<option :if={@prompt} value="" disabled selected><%= @prompt %></option>
<%= Phoenix.HTML.Form.options_for_select(@options, @value) %>
</select>

View file

@ -168,16 +168,22 @@ defmodule LivebookWeb.SettingsLive do
label="Wrap words in Markdown"
value={false}
/>
<.select_field
name="editor_mode"
label="Key bindings"
value="normal"
options={[
{"Default", "default"},
{"Emacs", "emacs"},
{"Vim", "vim"}
]}
/>
<div class="flex items-center gap-1 sm:gap-3 justify-between">
<span class="text-gray-700 flex gap-1 items-center">
Key bindings
</span>
<.select_field
name="editor_mode"
value={false}
class="pt-1 pb-1"
options={[
{"Default", "default"},
{"Emacs", "emacs"},
{"Vim", "vim"}
]}
/>
</div>
</div>
</div>
</div>