feat: add response filter placeholder (#1293)

This commit is contained in:
Tuyen Pham 2024-01-29 21:55:36 +07:00 committed by GitHub
parent 969c44023f
commit acc646a05d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,18 @@ const QueryResultFilter = ({ onChange, mode }) => {
return null;
}, [mode]);
const placeholderText = useMemo(() => {
if (mode.includes('json')) {
return '$.store.books..author';
}
if (mode.includes('xml')) {
return '/store/books//author';
}
return null;
}, [mode]);
return (
<div className={'response-filter relative'}>
<div className="absolute inset-y-0 left-0 pl-4 flex items-center">
@ -29,6 +41,7 @@ const QueryResultFilter = ({ onChange, mode }) => {
type="text"
name="response-filter"
id="response-filter"
placeholder={placeholderText}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"