diff --git a/packages/web/src/javascripts/Components/Input/DecoratedInput.tsx b/packages/web/src/javascripts/Components/Input/DecoratedInput.tsx index e537dc9ad..6ccee9ed6 100644 --- a/packages/web/src/javascripts/Components/Input/DecoratedInput.tsx +++ b/packages/web/src/javascripts/Components/Input/DecoratedInput.tsx @@ -1,3 +1,4 @@ +import { classNames } from '@standardnotes/utils' import { forwardRef, Fragment, Ref } from 'react' import { DecoratedInputProps } from './DecoratedInputProps' @@ -41,12 +42,18 @@ const DecoratedInput = forwardRef( ) => { const hasLeftDecorations = Boolean(left?.length) const hasRightDecorations = Boolean(right?.length) - const classNames = getClassNames(hasLeftDecorations, hasRightDecorations, roundedFull) + const computedClassNames = getClassNames(hasLeftDecorations, hasRightDecorations, roundedFull) return ( -
+
{left && ( -
+
{left.map((leftChild, index) => ( {leftChild} ))} @@ -55,7 +62,7 @@ const DecoratedInput = forwardRef( {right && ( -
+
{right.map((rightChild, index) => (
0 ? 'ml-3' : ''} key={index}> {rightChild} diff --git a/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts b/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts index 78a411390..61f132ce5 100644 --- a/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts +++ b/packages/web/src/javascripts/Components/Input/DecoratedInputProps.ts @@ -6,6 +6,8 @@ export type DecoratedInputProps = { className?: { container?: string input?: string + left?: string + right?: string } disabled?: boolean id?: string diff --git a/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/SearchPlugin/SearchDialog.tsx b/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/SearchPlugin/SearchDialog.tsx index 9aa16b546..b63893a2e 100644 --- a/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/SearchPlugin/SearchDialog.tsx +++ b/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/SearchPlugin/SearchDialog.tsx @@ -1,14 +1,9 @@ +import Button from '@/Components/Button/Button' import { useCommandService } from '@/Components/CommandProvider' +import DecoratedInput from '@/Components/Input/DecoratedInput' import { TranslateFromTopAnimation, TranslateToTopAnimation } from '@/Constants/AnimationConfigs' import { useLifecycleAnimation } from '@/Hooks/useLifecycleAnimation' -import { - ArrowDownIcon, - ArrowUpIcon, - CloseIcon, - ReplaceIcon, - ReplaceAllIcon, - ArrowRightIcon, -} from '@standardnotes/icons' +import { ArrowDownIcon, ArrowUpIcon, CloseIcon, ArrowRightIcon } from '@standardnotes/icons' import { keyboardStringForShortcut, SUPER_SEARCH_TOGGLE_CASE_SENSITIVE, @@ -82,14 +77,17 @@ export const SearchDialog = ({ open, closeDialog }: { open: boolean; closeDialog }} >
- { + onChange={(query) => { dispatch({ type: 'set-query', - query: e.target.value, + query, }) }} onKeyDown={(event) => { @@ -105,17 +103,18 @@ export const SearchDialog = ({ open, closeDialog }: { open: boolean; closeDialog }) } }} - className="rounded border border-border bg-default p-1 px-2" ref={focusOnMount} + right={[ +
+ {query.length > 0 && ( + <> + {currentResultIndex > -1 ? currentResultIndex + 1 + ' / ' : null} + {results.length} + + )} +
, + ]} /> - {results.length > 0 ? ( - - {currentResultIndex > -1 ? currentResultIndex + 1 + ' of ' : null} - {results.length} - - ) : ( - No results - )}
)}