Skip to content

Commit

Permalink
add focus on search box when opening tokens select modal (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmorice authored Nov 12, 2022
1 parent 3bdb9a5 commit 27357d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/web/components/input/search-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const SearchBox: FunctionComponent<
placeholder,
type,
disabled = false,
autoFocus,
className,
}) => {
const [isFocused, setIsFocused] = useState(false);
Expand All @@ -35,6 +36,7 @@ export const SearchBox: FunctionComponent<
className="w-full h-full appearance-none bg-transparent placeholder:body2 placeholder:text-osmoverse-500 transition-colors"
value={currentValue}
type={type}
autoFocus={autoFocus}
placeholder={placeholder}
autoComplete="off"
onFocus={(e: any) => {
Expand Down
1 change: 1 addition & 0 deletions packages/web/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type MainLayoutMenu = {
export interface InputProps<T> {
currentValue: T;
onInput: (value: T) => void;
autoFocus?: boolean;
onFocus?: (e: any) => void;
placeholder?: T;
}
Expand Down
1 change: 1 addition & 0 deletions packages/web/modals/token-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const TokenSelectModal: FunctionComponent<
>
<div className="p-4" onClick={(e) => e.stopPropagation()}>
<SearchBox
autoFocus
type="text"
className="!w-full"
placeholder={props.placeholder ?? t("components.searchTokens")}
Expand Down

3 comments on commit 27357d9

@vercel
Copy link

@vercel vercel bot commented on 27357d9 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 27357d9 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 27357d9 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.