Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aexol committed Oct 26, 2020
1 parent 69e762d commit e0be1ba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-editor",
"version": "4.0.0",
"version": "4.0.1",
"private": false,
"license": "MIT",
"description": "Visual node editor for GraphQL",
Expand Down
1 change: 1 addition & 0 deletions src/Graf/Node/RootExtendNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const RootExtendNode: React.FC<RootExtendNodeProps> = ({ node, libraryNod
<div className={`${NodeCaption}`}>
<span className={CaptionTitle}>extend</span>
<MenuSearch
autoFocus={false}
onClear={() => {
setFilterNodes('');
}}
Expand Down
1 change: 1 addition & 0 deletions src/Graf/Node/RootNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const RootNode: React.FC<RootNodeProps> = ({ node, libraryNode }) => {
<div className={`${NodeCaption} CaptionType-${node.name}`}>
<span className={CaptionTitle}>{node.name}</span>
<MenuSearch
autoFocus={false}
onClear={() => {
setFilterNodes('');
}}
Expand Down
5 changes: 3 additions & 2 deletions src/Graf/Node/components/Menu/MenuSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface MenuSearchProps {
value: string;
onChange: (v: string) => void;
onClear: () => void;
autoFocus?: boolean;
}

const Main = style({
Expand Down Expand Up @@ -54,7 +55,7 @@ const Wrapper = style({
padding: 12,
});

export const MenuSearch: React.FC<MenuSearchProps> = ({ value, onChange, onClear }) => {
export const MenuSearch: React.FC<MenuSearchProps> = ({ value, onChange, onClear, autoFocus = true }) => {
const ref = useRef<HTMLInputElement>(null);
return (
<div className={Wrapper}>
Expand All @@ -68,7 +69,7 @@ export const MenuSearch: React.FC<MenuSearchProps> = ({ value, onChange, onClear
)}
<input
ref={ref}
autoFocus
autoFocus={autoFocus}
className={Main}
placeholder="Search..."
type="text"
Expand Down

0 comments on commit e0be1ba

Please sign in to comment.