forked from italia/design-comuni-plone-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added live search in CartellaModulisticaView (#260)
* feat: added live search in CartellaModulisticaView * fix: fix filter cartella modulistica * fix: fix search modulistica * chore: update files CartellaModulisticaView + SearchBar * fix: fix search Cartella Modulistica performance * chore: removed unnecessary code --------- Co-authored-by: Wagner Trezub <[email protected]>
- Loading branch information
1 parent
7ef704a
commit 9469698
Showing
12 changed files
with
179 additions
and
23 deletions.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Plone\n" | ||
"POT-Creation-Date: 2023-07-20T13:42:57.004Z\n" | ||
"POT-Creation-Date: 2023-07-25T10:15:46.866Z\n" | ||
"Last-Translator: Plone i18n <[email protected]>\n" | ||
"Language-Team: Plone i18n <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
|
@@ -1164,6 +1164,11 @@ msgstr "" | |
msgid "cartellamodulistica_formati_scaricabili" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/View/CartellaModulisticaView/SearchBar | ||
# defaultMessage: Type in a keyword to find modules | ||
msgid "cartellamodulistica_search" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/View/ServizioView/ServizioCasiParticolari | ||
# defaultMessage: Casi particolari | ||
msgid "casi_particolari" | ||
|
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
73 changes: 73 additions & 0 deletions
73
src/components/ItaliaTheme/View/CartellaModulisticaView/SearchBar.jsx
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,73 @@ | ||
/** | ||
* SearchBar view component. | ||
* @module components/theme/View/SearchBar | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { useIntl, defineMessages } from 'react-intl'; | ||
import { Container } from 'design-react-kit/dist/design-react-kit'; | ||
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme'; | ||
|
||
const messages = defineMessages({ | ||
search_faq: { | ||
id: 'cartellamodulistica_search', | ||
defaultMessage: 'Type in a keyword to find modules', | ||
}, | ||
}); | ||
|
||
/** | ||
* SearchBar view component class. | ||
* @function SearchBar | ||
* @params {object} content Content object. | ||
* @returns {string} Markup of the component. | ||
*/ | ||
|
||
const SearchBar = ({ setSearchableText }) => { | ||
const intl = useIntl(); | ||
const [focusSearch, setFocusSearch] = useState(false); | ||
|
||
return ( | ||
<div className="section section-muted search-section full-width mb-3"> | ||
<Container className="px-4"> | ||
<div className="form-group mb-0"> | ||
<div className="input-group shadow"> | ||
<div className="input-group-prepend"> | ||
<div className="input-group-text rounded-left"> | ||
<Icon | ||
icon="it-search" | ||
padding={false} | ||
size="sm" | ||
aria-hidden="true" | ||
/> | ||
</div> | ||
</div> | ||
<label | ||
className={focusSearch ? 'active' : ''} | ||
htmlFor="search-field" | ||
> | ||
{intl.formatMessage(messages.search_faq)}... | ||
</label> | ||
<input | ||
className="form-control rounded-right" | ||
id="search-field" | ||
name="search-field" | ||
onBlur={(a, b) => { | ||
setFocusSearch(false); | ||
}} | ||
onFocus={() => { | ||
setFocusSearch(true); | ||
}} | ||
onChange={(e) => { | ||
setSearchableText(e?.target?.value || ''); | ||
}} | ||
placeholder={intl.formatMessage(messages.search_faq)} | ||
type="text" | ||
/> | ||
</div> | ||
</div> | ||
</Container> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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
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