@ludo.ninja/components 2.1.38 → 2.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.SearchInputContainer = void 0;
|
|
30
30
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
|
-
|
|
32
|
+
// import { useRouter } from "next/router";
|
|
33
33
|
const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
|
|
34
34
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
35
35
|
const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
|
|
@@ -60,9 +60,10 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
60
60
|
}));
|
|
61
61
|
const { isMobile } = (0, screen_1.useWindowDimensionsWithServerInitial)();
|
|
62
62
|
const { load, topEntities, loading, clearTopEntitiesState } = (0, useFetchFindAllTopEntitiesByName_1.useFetchFindAllTopEntitiesByName)();
|
|
63
|
-
const router =
|
|
63
|
+
// const router = useRouter();
|
|
64
64
|
(0, react_1.useEffect)(() => {
|
|
65
|
-
const term = router.query?.term;
|
|
65
|
+
// const term = router.query?.term;
|
|
66
|
+
const term = new URLSearchParams(window.location.search).get("term");
|
|
66
67
|
if (term) {
|
|
67
68
|
setSearchValue(term);
|
|
68
69
|
}
|
|
@@ -143,11 +144,19 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
|
|
|
143
144
|
const { value } = e.target;
|
|
144
145
|
const newSearchValue = value.length ? searchValue : "";
|
|
145
146
|
const searchDomain = ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["search"];
|
|
147
|
+
const currentPath = window.location.pathname;
|
|
146
148
|
if (searchDomain === window.origin &&
|
|
147
|
-
seacrhTabs_1.searchTabs.find((el) =>
|
|
148
|
-
await router.replace(
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
seacrhTabs_1.searchTabs.find((el) => currentPath.includes(el.link))) {
|
|
150
|
+
// await router.replace(
|
|
151
|
+
// {
|
|
152
|
+
// query: { ...router.query, term: newSearchValue },
|
|
153
|
+
// },
|
|
154
|
+
// undefined,
|
|
155
|
+
// { shallow: true },
|
|
156
|
+
// );
|
|
157
|
+
const newUrl = new URL(window.location.href);
|
|
158
|
+
newUrl.searchParams.set("term", newSearchValue);
|
|
159
|
+
window.history.replaceState({}, "", newUrl.toString());
|
|
151
160
|
setSearchFocused(false);
|
|
152
161
|
onFocusHandler?.(false);
|
|
153
162
|
closeOverlay();
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
|
|
7
|
+
// import { useRouter } from 'next/router';
|
|
8
8
|
const ScreenWidth_1 = require("../../../styles/ScreenWidth");
|
|
9
9
|
const scale_1 = require("../../../utils/adaptive/scale");
|
|
10
10
|
const screen_1 = require("../../../utils/screen");
|
|
@@ -41,15 +41,21 @@ const SearchCloseIconResize = () => {
|
|
|
41
41
|
};
|
|
42
42
|
// Components
|
|
43
43
|
const SearchCloseMoreButtons = ({ isNeedToShow, position, clearSearchValue, }) => {
|
|
44
|
-
const router =
|
|
45
|
-
const { term } = router.query;
|
|
44
|
+
// const router = useRouter();
|
|
45
|
+
// const { term } = router.query;
|
|
46
46
|
return ((0, jsx_runtime_1.jsx)(StyledSearchCloseMoreButtons, { position: position, children: isNeedToShow ? ((0, jsx_runtime_1.jsx)(StyledCloseIcon, { onClick: () => {
|
|
47
|
+
const term = new URLSearchParams(window.location.search).get('term');
|
|
47
48
|
if (term) {
|
|
48
|
-
router
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})
|
|
52
|
-
|
|
49
|
+
// router
|
|
50
|
+
// .push({
|
|
51
|
+
// query: { ...router.query, term: [] },
|
|
52
|
+
// })
|
|
53
|
+
// .then(() => clearSearchValue(''));
|
|
54
|
+
const params = new URLSearchParams(window.location.search);
|
|
55
|
+
params.delete('term');
|
|
56
|
+
const newUrl = `${window.location.pathname}?${params.toString()}`;
|
|
57
|
+
window.history.pushState({}, '', newUrl);
|
|
58
|
+
clearSearchValue('');
|
|
53
59
|
}
|
|
54
60
|
clearSearchValue('');
|
|
55
61
|
}, children: (0, jsx_runtime_1.jsx)(SearchCloseIconResize, {}) })) : null }));
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const link_1 = __importDefault(require("next/link"));
|
|
8
7
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
8
|
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
10
9
|
const utils_1 = require("@ludo.ninja/utils");
|
|
@@ -108,7 +107,7 @@ const StyledSearchSuggestionsItem = styled_components_1.default.div `
|
|
|
108
107
|
}
|
|
109
108
|
`;
|
|
110
109
|
// Components
|
|
111
|
-
const SearchSuggestionsItem = ({ name, link, imgUrl, borderRadius, additionalHTML, searchTerm, }) => ((0, jsx_runtime_1.jsx)(StyledSearchSuggestionsItem, { borderRadius: borderRadius, children: (0, jsx_runtime_1.jsxs)(
|
|
110
|
+
const SearchSuggestionsItem = ({ name, link, imgUrl, borderRadius, additionalHTML, searchTerm, }) => ((0, jsx_runtime_1.jsx)(StyledSearchSuggestionsItem, { borderRadius: borderRadius, children: (0, jsx_runtime_1.jsxs)("a", { href: link, className: 'link', children: [(0, jsx_runtime_1.jsx)(ImageInterceptor_1.ImageInterceptor, { borderRadiusSkeleton: borderRadius && 16, children: (0, jsx_runtime_1.jsx)("img", { src: imgUrl, alt: 'pirate', width: 32, height: 32 }) }), (0, jsx_runtime_1.jsx)("div", { className: 'text', children: (0, jsx_runtime_1.jsx)("p", { className: 'regular', children: (0, utils_1.searchQueryLetters)({
|
|
112
111
|
text: name,
|
|
113
112
|
searchQuery: searchTerm,
|
|
114
113
|
className: 'strong',
|