-
Notifications
You must be signed in to change notification settings - Fork 955
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Project doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU Data table integration comes later Reviewed By: lblasa Differential Revision: D48648822 fbshipit-source-id: 74f92c0e818c4507fd6575f6a122d107373cfe0c
- Loading branch information
1 parent
2affcbd
commit caf55f5
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
desktop/flipper-plugin/src/ui/PowerSearch/PowerSearchStringSetTerm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
import {Select} from 'antd'; | ||
import React from 'react'; | ||
|
||
type PowerSearchStringSetTermProps = { | ||
onCancel: () => void; | ||
onChange: (value: string[]) => void; | ||
}; | ||
|
||
export const PowerSearchStringSetTerm: React.FC< | ||
PowerSearchStringSetTermProps | ||
> = ({onCancel, onChange}) => { | ||
const selectValueRef = React.useRef<string[]>(); | ||
|
||
return ( | ||
<Select | ||
mode="tags" | ||
autoFocus | ||
style={{minWidth: 100}} | ||
placeholder="..." | ||
onBlur={() => { | ||
if (!selectValueRef.current?.length) { | ||
onCancel(); | ||
} | ||
}} | ||
open={false} | ||
onChange={(value) => { | ||
if (!value.length) { | ||
onCancel(); | ||
return; | ||
} | ||
selectValueRef.current = value; | ||
onChange(value); | ||
}} | ||
onClear={onCancel} | ||
onKeyDown={(event) => { | ||
if (event.key === 'Enter' || event.key === 'Escape') { | ||
event.currentTarget.blur(); | ||
} | ||
}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters