diff --git a/packages/web/src/javascripts/Components/ApplicationView/ApplicationView.tsx b/packages/web/src/javascripts/Components/ApplicationView/ApplicationView.tsx index 93238f496..b3a6ee2bc 100644 --- a/packages/web/src/javascripts/Components/ApplicationView/ApplicationView.tsx +++ b/packages/web/src/javascripts/Components/ApplicationView/ApplicationView.tsx @@ -186,7 +186,6 @@ const ApplicationView: FunctionComponent = ({ application, mainApplicatio noAccountWarningController={viewControllerManager.noAccountWarningController} noteTagsController={viewControllerManager.noteTagsController} notesController={viewControllerManager.notesController} - searchOptionsController={viewControllerManager.searchOptionsController} selectionController={viewControllerManager.selectionController} /> diff --git a/packages/web/src/javascripts/Components/Bubble/Bubble.tsx b/packages/web/src/javascripts/Components/Bubble/Bubble.tsx index 268e49204..31258c9a2 100644 --- a/packages/web/src/javascripts/Components/Bubble/Bubble.tsx +++ b/packages/web/src/javascripts/Components/Bubble/Bubble.tsx @@ -7,17 +7,13 @@ type Props = { } const styles = { - base: 'px-2 py-1 text-center rounded-full cursor-pointer transition border border-solid active:border-info active:bg-info active:text-neutral-contrast', + base: 'active:border-info active:bg-info active:text-neutral-contrast flex-grow cursor-pointer rounded-full border border-solid px-2 py-1 text-center transition', unselected: 'text-neutral border-secondary-border', - selected: 'border-info bg-info text-neutral-contrast', + selected: 'text-neutral-contrast border-info bg-info', } const Bubble: FunctionComponent = ({ label, selected, onSelect }) => ( - + {label} ) diff --git a/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx b/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx index 93b63508a..af032ea03 100644 --- a/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx @@ -66,7 +66,7 @@ const ContentList: FunctionComponent = ({ return (
= ({ noAccountWarningController, noteTagsController, notesController, - searchOptionsController, selectionController, }) => { const itemsViewPanelRef = useRef(null) const { - clearFilterText, completedFullSync, createNewNote, - noteFilterText, - onFilterEnter, optionsSubtitle, paginate, panelTitle, @@ -70,13 +54,10 @@ const ContentListView: FunctionComponent = ({ searchBarElement, selectNextItem, selectPreviousItem, - setNoteFilterText, } = itemListController const { selectedItems } = selectionController - const [focusedSearch, setFocusedSearch] = useState(false) - const isFilesSmartView = useMemo( () => navigationController.selected?.uuid === SystemViewId.Files, [navigationController.selected?.uuid], @@ -166,25 +147,6 @@ const ContentListView: FunctionComponent = ({ selectionController, ]) - const onNoteFilterTextChange: ChangeEventHandler = useCallback( - (e) => { - setNoteFilterText(e.target.value) - }, - [setNoteFilterText], - ) - - const onSearchFocused = useCallback(() => setFocusedSearch(true), []) - const onSearchBlurred = useCallback(() => setFocusedSearch(false), []) - - const onNoteFilterKeyUp: KeyboardEventHandler = useCallback( - (e) => { - if (e.key === KeyboardKey.Enter) { - onFilterEnter() - } - }, - [onFilterEnter], - ) - const panelResizeFinishCallback: ResizeFinishCallback = useCallback( (width, _lastLeft, _isMaxWidth, isCollapsed) => { application.setPreference(PrefKey.NotesPanelWidth, width).catch(console.error) @@ -211,7 +173,7 @@ const ContentListView: FunctionComponent = ({ ref={itemsViewPanelRef} >
-
+
= ({ isFilesSmartView={isFilesSmartView} optionsSubtitle={optionsSubtitle} /> -
-
- - {noteFilterText && ( - - )} -
- - {(focusedSearch || noteFilterText) && ( -
- -
- )} -
{ +const getClassNames = (hasLeftDecorations: boolean, hasRightDecorations: boolean, roundedFull?: boolean) => { return { - container: `flex items-stretch position-relative bg-default border border-solid border-border rounded focus-within:ring-2 focus-within:ring-info overflow-hidden text-sm ${ + container: `position-relative flex items-stretch overflow-hidden border border-solid border-border bg-default text-sm focus-within:ring-2 focus-within:ring-info ${ !hasLeftDecorations && !hasRightDecorations ? 'px-2 py-1.5' : '' - }`, - input: `w-full border-0 focus:shadow-none focus:outline-none focus:ring-none bg-transparent text-text ${ + } ${roundedFull ? 'rounded-full' : 'rounded'}`, + input: `focus:ring-none w-full border-0 bg-transparent text-text focus:shadow-none focus:outline-none ${ !hasLeftDecorations && hasRightDecorations ? 'pl-2' : '' } ${hasRightDecorations ? 'pr-2' : ''}`, disabled: 'bg-passive-5 cursor-not-allowed', @@ -19,27 +19,32 @@ const getClassNames = (hasLeftDecorations: boolean, hasRightDecorations: boolean const DecoratedInput = forwardRef( ( { - type = 'text', + autocomplete = false, className = '', - id = '', disabled = false, + id, left, - right, - value, - placeholder = '', + onBlur, onChange, onFocus, onKeyDown, - autocomplete = false, + onKeyUp, + placeholder = '', + right, + type = 'text', + title, + value, + roundedFull, }: DecoratedInputProps, ref: Ref, ) => { const hasLeftDecorations = Boolean(left?.length) const hasRightDecorations = Boolean(right?.length) - const classNames = getClassNames(hasLeftDecorations, hasRightDecorations) + const classNames = getClassNames(hasLeftDecorations, hasRightDecorations, roundedFull) return (
+
{left && (
{left.map((leftChild, index) => ( @@ -49,18 +54,21 @@ const DecoratedInput = forwardRef( )} onChange && onChange((e.target as HTMLInputElement).value)} onFocus={onFocus} onKeyDown={onKeyDown} - data-lpignore={type !== 'password' ? true : false} - autoComplete={autocomplete ? 'on' : 'off'} + onKeyUp={onKeyUp} + placeholder={placeholder} ref={ref} + title={title} + type={type} + value={value} /> {right && ( diff --git a/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts b/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts index 078f8c85e..d5cf373be 100644 --- a/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts +++ b/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts @@ -1,16 +1,20 @@ import { FocusEventHandler, KeyboardEventHandler, ReactNode } from 'react' export type DecoratedInputProps = { - type?: 'text' | 'email' | 'password' + autocomplete?: boolean className?: string - id?: string disabled?: boolean + id?: string left?: ReactNode[] - right?: ReactNode[] - value?: string - placeholder?: string + onBlur?: FocusEventHandler onChange?: (text: string) => void onFocus?: FocusEventHandler onKeyDown?: KeyboardEventHandler - autocomplete?: boolean + onKeyUp?: KeyboardEventHandler + placeholder?: string + right?: ReactNode[] + title?: string + type?: React.HTMLInputTypeAttribute + value?: string + roundedFull?: boolean } diff --git a/packages/web/src/javascripts/Components/Navigation/Navigation.tsx b/packages/web/src/javascripts/Components/Navigation/Navigation.tsx index 5057679e5..563ed371f 100644 --- a/packages/web/src/javascripts/Components/Navigation/Navigation.tsx +++ b/packages/web/src/javascripts/Components/Navigation/Navigation.tsx @@ -6,6 +6,7 @@ import { ApplicationEvent, PrefKey } from '@standardnotes/snjs' import { observer } from 'mobx-react-lite' import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react' import PanelResizer, { PanelSide, ResizeFinishCallback, PanelResizeType } from '@/Components/PanelResizer/PanelResizer' +import SearchBar from '@/Components/SearchBar/SearchBar' type Props = { application: WebApplication @@ -50,6 +51,10 @@ const Navigation: FunctionComponent = ({ application }) => { ref={setRef} >