diff --git a/frontend/control-center/src/components/TopBar/index.module.scss b/frontend/control-center/src/components/TopBar/index.module.scss index ad46613001..2c62c3ede5 100644 --- a/frontend/control-center/src/components/TopBar/index.module.scss +++ b/frontend/control-center/src/components/TopBar/index.module.scss @@ -269,5 +269,5 @@ } .animateOut { - animation: topbarDropdownOut 300ms ease; + animation: topbarDropdownOut 300ms forwards; } diff --git a/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.module.scss b/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.module.scss index 3a6e39f3f3..c35e9452c5 100644 --- a/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.module.scss +++ b/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.module.scss @@ -1,5 +1,6 @@ @import 'assets/scss/fonts.scss'; @import 'assets/scss/colors.scss'; +@import 'assets/scss/animations.scss'; .container { display: flex; @@ -32,39 +33,17 @@ } .searchField { - width: 200px; + width: 300px; background: var(--color-background-white); border: 1px solid var(--color-airy-blue); border-radius: 4px; + height: 32px; svg { color: black; } } -@keyframes animateFilterModalIn { - 0% { - transform: translateX(200px); - opacity: 0; - } - - 100% { - transform: translateX(0px); - opacity: 1; - } -} - -@keyframes animateFilterModalOut { - 0% { - transform: translateX(0px); - opacity: 1; - } - 100% { - transform: translateX(200px); - opacity: 0; - } -} - .filterModal { position: absolute; top: 170px; @@ -75,5 +54,13 @@ animation: animateFilterModalIn 500ms ease; } .filterModalAnimOut { - animation: animateFilterModalOut 500ms ease; + animation: animateFilterModalOut 500ms forwards; +} + +.animateIn { + animation: searchfieldAnimIn 300ms ease; +} + +.animateOut { + animation: searchfieldAnimOut 300ms forwards; } diff --git a/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.tsx b/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.tsx index b929c6e662..4f1da8b8ea 100644 --- a/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.tsx +++ b/frontend/control-center/src/pages/Catalog/CatalogSearchBar/CatalogSearchBar.tsx @@ -20,24 +20,30 @@ export const CatalogSearchBar = (props: CatalogSearchBarProps) => { const [showSearchField, setShowingSearchField] = useState(false); const [showFilter, setShowFilter] = useState(false); const [animationAction, setAnimationAction] = useState(false); + const [animationActionSearchfield, setAnimationActionSearchfield] = useState(false); const toggleShowFilter = useCallback(() => { useAnimation(showFilter, setShowFilter, setAnimationAction, 500); }, [showFilter, setShowFilter]); + const showSearchFieldToggle = useCallback(() => { + useAnimation(showSearchField, setShowingSearchField, setAnimationActionSearchfield, 300); + setQuery(''); + props.setQuery(''); + }, [showSearchField, setShowingSearchField]); + useEffect(() => { props.setCurrentFilter(currentFilter); }, [currentFilter]); - const handleSearchClick = () => setShowingSearchField(!showSearchField); - return (
{showSearchField ? ( - + { /> ) : ( - + )} {
-
- {showingSearchField && ( - setSearchText(value)} - autoFocus={true} - resetClicked={() => setSearchText('')} - /> - )} -
+ {showingSearchField && ( + setSearchText(value)} + autoFocus={true} + resetClicked={() => setSearchText('')} + /> + )}
-
- -
+ setSearchText('')} + autoFocus={true} + dataCy={cySearchField} + />
) : (
-