From efdc0d656fbc03015c087362231d9764b30b2db7 Mon Sep 17 00:00:00 2001 From: Akshay Agrawal Date: Fri, 7 Jun 2024 17:52:48 -0700 Subject: [PATCH] chore: tidy config form style (#1578) This change improves the legibility of the user config form. Styling for the user/app config was inconsistent across items, making the config menu difficult to read. --- .../components/app-config/app-config-form.tsx | 8 +- .../app-config/user-config-form.tsx | 224 ++++++++++-------- 2 files changed, 124 insertions(+), 108 deletions(-) diff --git a/frontend/src/components/app-config/app-config-form.tsx b/frontend/src/components/app-config/app-config-form.tsx index e3cb58214cb..4d5f6dfd3d5 100644 --- a/frontend/src/components/app-config/app-config-form.tsx +++ b/frontend/src/components/app-config/app-config-form.tsx @@ -63,7 +63,9 @@ export const AppConfigForm: React.FC = () => { control={form.control} name="width" render={({ field }) => ( - + Width { name="app_title" render={({ field }) => (
- - Application title + + App title { const [config, setConfig] = useUserConfig(); const formElement = useRef(null); @@ -73,7 +75,8 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="save.autosave" render={({ field }) => ( - + + Autosave { }} /> - Autosave )} /> @@ -93,7 +95,7 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="save.autosave_delay" render={({ field }) => ( - + Autosave delay (seconds) @@ -122,7 +124,8 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="save.format_on_save" render={({ field }) => ( - + + Format on save { }} /> - Format on save )} /> @@ -142,29 +144,32 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="formatting.line_length" render={({ field }) => ( - - Line length +
+ + Line length + + + { + field.onChange(value); + onSubmit(form.getValues()); + }} + /> + + + + + Maximum line length when formatting code. - - - { - field.onChange(value); - onSubmit(form.getValues()); - }} - /> - - - - +
)} /> { name="completion.activate_on_typing" render={({ field }) => (
- + + Autocomplete { }} /> - Autocomplete When unchecked, code completion is still available through a @@ -196,24 +201,27 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="keymap.preset" render={({ field }) => ( - - Keymap - - field.onChange(e.target.value)} - value={field.value} - disabled={field.disabled} - className="inline-flex mr-2" - > - {KEYMAP_PRESETS.map((option) => ( - - ))} - - - +
+ + Keymap + + field.onChange(e.target.value)} + value={field.value} + disabled={field.disabled} + className="inline-flex mr-2" + > + {KEYMAP_PRESETS.map((option) => ( + + ))} + + + + +
- +
)} />
@@ -239,36 +247,39 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="display.default_width" render={({ field }) => ( - - Default width - - field.onChange(e.target.value)} - value={field.value} - disabled={field.disabled} - className="inline-flex mr-2" - > - {APP_WIDTHS.map((option) => ( - - ))} - - - +
+ + Default width + + field.onChange(e.target.value)} + value={field.value} + disabled={field.disabled} + className="inline-flex mr-2" + > + {APP_WIDTHS.map((option) => ( + + ))} + + + + + - The default app width for new notebooks; overridden by - "width" in the application config. + The default app width for new notebooks; overridden by "width" + in the application config. - +
)} /> ( - + Theme { control={form.control} name="display.code_editor_font_size" render={({ field }) => ( - + Code editor font size @@ -319,28 +330,31 @@ export const UserConfigForm: React.FC = () => { control={form.control} name="display.cell_output" render={({ field }) => ( - - Cell output area - - field.onChange(e.target.value)} - value={field.value} - disabled={field.disabled} - className="inline-flex mr-2" - > - {["above", "below"].map((option) => ( - - ))} - - - +
+ + Cell output area + + field.onChange(e.target.value)} + value={field.value} + disabled={field.disabled} + className="inline-flex mr-2" + > + {["above", "below"].map((option) => ( + + ))} + + + + + Where to display cell's output. - +
)} />
@@ -352,7 +366,7 @@ export const UserConfigForm: React.FC = () => { disabled={isWasm} name="package_management.manager" render={({ field }) => ( - + Manager { control={form.control} name="runtime.auto_instantiate" render={({ field }) => ( - + + + Autorun on startup + { onCheckedChange={field.onChange} /> - - Autorun on startup - )} /> @@ -400,7 +414,8 @@ export const UserConfigForm: React.FC = () => { name="runtime.on_cell_change" render={({ field }) => (
- + + On cell change { ))} - On cell change Whether marimo should automatically run cells or just mark @@ -432,7 +446,10 @@ export const UserConfigForm: React.FC = () => { name="runtime.auto_reload" render={({ field }) => (
- + + + On module change + { ))} - - On module change - Whether marimo should automatically reload modules before @@ -465,24 +479,24 @@ export const UserConfigForm: React.FC = () => {
AI Assist

- You will need to store an API key in your{" "} - ~/.marimo.toml file. See the{" "} + Add an API key to ~/.marimo.toml to + activate marimo's AI assistant; see{" "} - documentation + docs {" "} - for more information. + for more info.

( - + Base URL { disabled={isWasm} name="ai.open_ai.model" render={({ field: { value, onChange, ...field } }) => ( - + Model