From f85b3c1359fa3dfb1dcc630c45e5a35a3ab5d6b5 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Thu, 12 Jan 2023 11:33:47 +1100 Subject: [PATCH] feat(menu): clone notion file upload --- src/core/menu/components.mjs | 58 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/src/core/menu/components.mjs b/src/core/menu/components.mjs index d8b14f6..2af0a7b 100644 --- a/src/core/menu/components.mjs +++ b/src/core/menu/components.mjs @@ -78,9 +78,30 @@ const HotkeyInput = ({}, ...children) => {}; const ColorInput = ({}, ...children) => {}; -const FileInput = ({}, ...children) => {}; +const FileInput = ({ extensions, ...props }, ..._children) => { + // todo: show uploaded file name, clear prev upload + const { html } = globalThis.__enhancerApi; + return html``; +}; -const Select = ({ values, onchange, ...props }, ...children) => { +const Select = ({ values, onchange, ...props }, ..._children) => { const { html } = globalThis.__enhancerApi, updateWidth = ($select) => { const $tmp = html` { @@ -183,23 +204,9 @@ const Option = ({ mod, type, ...props }, ..._children) => { // break; // case "color": // break; - // case "file": - // break; - //
- // ${props.values[0]} - // - // - // - //
+ case "file": + $input = html`<${FileInput} extensions=${props.extensions} />`; + break; case "select": $input = html`<${Select} values=${props.values} />`; break; @@ -221,4 +228,13 @@ const Option = ({ mod, type, ...props }, ..._children) => { `; }; -export { Sidebar, SidebarSection, SidebarButton, View, Select, Toggle, Option }; +export { + Sidebar, + SidebarSection, + SidebarButton, + View, + FileInput, + Select, + Toggle, + Option, +};