mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
* Added localisation * Closed modal after language selection * updated transaltaion setup * Updated language tooltip * Added fallback language support * Adding english library resource for translation (#3844) * Adding English dictionary for the widget lists in the inspector * added leftSideBar object in en.json and implemented it for leftSidebar icon text * renamed leftSideBar to leftSidebar and added resources for tip in the left side bar * added english translation resources for leftsidebar debugger * added english language resources for the global settings * added english language resources for data sources in left sidebar * added english language resources for the share button and share modal in the editor * added english language resources for release button, manageOrgUsers, appVersionManager * added english language resources for Queries and Please select a widget to inspect in the editor * added english language resources for data source list , data source manager, and query manager(partially) * added english language resources for queryManager, transformation, preview * added english language resources for dark mode toggle in the headers inside homepage * added fallback message for dark mode toggle * added resources for language change in the headers inside homepage * added resources for notification center in the header inside homepage * added resources for organization and manage users components in header inside homepage * added resources in manageGroupPermission * added resources for manageGroupPermissionsResources component * added resources for manageSSO and generalSettings components * added resources for google sso * added resources for github sso * added resources for environment variables in manageSSO * added resources for profile and setting page * added resources for app card and app card menu * added resources for folder section and app list in homepage * added resources for header section in the homepage * added resources for pagination in homepage * added resources for modals in the homepage * added resources for blank page * added resources for login page * added resources for forgot password page * added resources for sign up page * added resources for onBoarding component * added resources for reset password page * deleted duplicate key for readDocumentation * deleted duplicate key for cancel in en.json and added translation for cancel at few places * removing duplicate copy of save key in en.json * added translation for CommentActions.jsx components * deleted duplicate copy of search key in en.json and added resources for create and search queries , select keys * fix typo errors * fixed typo errors * shorten the key for loginAndSignUpAndForgotPassword to loginSignupPage in en.json file and related files * shorten the key noLoginMethodsEnabledForThisWorkspace to noLoginMethodsEnabled * shorten the key pleaseCheckYourEmailForConfirmationLink to emailConfirmLink * shorten the key dontHaveAccountYet to dontHaveAccount * shorten keys from loginSignupPage key in en.json * shorten keys of shareModal nested object in en.json * shorten the key in appVersionManager nested object * shorten the keys for queryManager nested object in the en.json * delete duplicate copy of environmentVar and shorten manageEnvironmentVariables,environmentVariables * shorten keys in the organization nested object * shorten keys in the homePage nested object in en.json file * added inspector and eventManager empty object * added resources to RedirectSSO component * added resources for OAuth2 * added resources for TemplateCard.jsx * added resources for TemplateLibraryModal.jsx * added resources for ConfirmationPage.jsx * added resources for ConfirmationPage component * removed translation in App.jsx file * added resources for Slack.jsx * added resources for GoogleSheets.jsx * added resources for CodeBuilder.jsx * added resources for CommentBody and CommentFooter * added resources for TestConnection component * added resources for AllignButton.jsx * added resources for Openapi and Stripe components * added resources for ErrorBoundary * added resources for Viewer.jsx * Translation for widgets, table Co-authored-by: Kavin Venkatachalam <kavin.saratha@gmail.com> * Commented Language selection * Fixed typos * Updated fr.json file Co-authored-by: Manish Kushare <kushare.manish9@gmail.com>
92 lines
2.7 KiB
JavaScript
92 lines
2.7 KiB
JavaScript
import React, { useState, useEffect } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import useDebounce from '@/_hooks/useDebounce';
|
|
|
|
export function SearchBox({
|
|
width = '200px',
|
|
onSubmit,
|
|
debounceDelay = 300,
|
|
darkMode = false,
|
|
placeholder = 'Search',
|
|
}) {
|
|
const [searchText, setSearchText] = useState('');
|
|
const debouncedSearchTerm = useDebounce(searchText, debounceDelay);
|
|
const [isFocused, setFocussed] = useState(false);
|
|
|
|
const handleChange = (e) => {
|
|
setSearchText(e.target.value);
|
|
};
|
|
|
|
const clearSearchText = () => {
|
|
setSearchText('');
|
|
};
|
|
|
|
useEffect(() => {
|
|
onSubmit(debouncedSearchTerm);
|
|
}, [debouncedSearchTerm, onSubmit]);
|
|
|
|
return (
|
|
<div className="search-box-wrapper">
|
|
<div className="input-icon mb-3">
|
|
{!isFocused && (
|
|
<span className="input-icon-addon">
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
className="icon"
|
|
width="24"
|
|
height="24"
|
|
viewBox="0 0 24 24"
|
|
strokeWidth="2"
|
|
stroke="currentColor"
|
|
fill="none"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
>
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
<circle cx="10" cy="10" r="7" />
|
|
<line x1="21" y1="21" x2="15" y2="15" />
|
|
</svg>
|
|
</span>
|
|
)}
|
|
<input
|
|
style={{ width }}
|
|
type="text"
|
|
value={searchText}
|
|
onChange={handleChange}
|
|
className={`form-control ${darkMode && 'dark-theme-placeholder'}`}
|
|
placeholder={placeholder}
|
|
onFocus={() => setFocussed(true)}
|
|
onBlur={() => setFocussed(false)}
|
|
data-cy="home-page-search-bar"
|
|
/>
|
|
{isFocused && searchText && (
|
|
<span className="input-icon-addon end">
|
|
<div className="d-flex" onMouseDown={clearSearchText} title="clear">
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
className="icon"
|
|
width="24"
|
|
height="24"
|
|
viewBox="0 0 24 24"
|
|
strokeWidth="2"
|
|
stroke="currentColor"
|
|
fill="none"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
>
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
<line x1="18" y1="6" x2="6" y2="18" />
|
|
<line x1="6" y1="6" x2="18" y2="18" />
|
|
</svg>
|
|
</div>
|
|
</span>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
SearchBox.propTypes = {
|
|
onSubmit: PropTypes.func.isRequired,
|
|
debounceDelay: PropTypes.number,
|
|
width: PropTypes.string,
|
|
};
|