astro-tractstack 2.0.0-rc.37 → 2.0.0-rc.39
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.
package/package.json
CHANGED
|
@@ -74,7 +74,7 @@ export default function SearchModal({
|
|
|
74
74
|
<Dialog.Backdrop className="fixed inset-0 z-50 bg-black bg-opacity-50 backdrop-blur-sm" />
|
|
75
75
|
<Dialog.Positioner className="fixed inset-0 z-50 flex items-start justify-center p-4 pt-16">
|
|
76
76
|
<Dialog.Content
|
|
77
|
-
className="bg-mywhite w-full max-w-
|
|
77
|
+
className="bg-mywhite w-full max-w-5xl overflow-hidden rounded-lg shadow-2xl"
|
|
78
78
|
style={{ height: '80vh', display: 'flex', flexDirection: 'column' }}
|
|
79
79
|
>
|
|
80
80
|
{/* Fixed Header */}
|
|
@@ -97,7 +97,14 @@ export default function SearchResults({
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
return items
|
|
100
|
+
return items.sort((a, b) => {
|
|
101
|
+
const aHasRealImage = a.imageSrc !== '/static.jpg';
|
|
102
|
+
const bHasRealImage = b.imageSrc !== '/static.jpg';
|
|
103
|
+
|
|
104
|
+
if (aHasRealImage && !bHasRealImage) return -1;
|
|
105
|
+
if (!aHasRealImage && bHasRealImage) return 1;
|
|
106
|
+
return 0;
|
|
107
|
+
});
|
|
101
108
|
}, [results, contentMap]);
|
|
102
109
|
|
|
103
110
|
const totalPages = Math.ceil(allResultItems.length / ITEMS_PER_PAGE);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
2
|
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
|
3
|
+
import { initSearch } from '@/utils/customHelpers';
|
|
3
4
|
import SearchModal from './SearchModal';
|
|
4
5
|
import type { FullContentMapItem } from '@/types/tractstack';
|
|
5
6
|
|
|
@@ -18,6 +19,10 @@ export default function SearchWrapper({ contentMap }: SearchWrapperProps) {
|
|
|
18
19
|
setIsSearchOpen(false);
|
|
19
20
|
};
|
|
20
21
|
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
initSearch();
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
21
26
|
return (
|
|
22
27
|
<>
|
|
23
28
|
<button
|
|
@@ -21,3 +21,9 @@ export function getResourceImage(
|
|
|
21
21
|
console.log(`please define getResourceImage`, id, slug, category);
|
|
22
22
|
return '/static.jpg';
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
// Initialize search data - override in custom implementation
|
|
26
|
+
export function initSearch(): void {
|
|
27
|
+
// Default implementation does nothing
|
|
28
|
+
// Override this function in your custom implementation to load search data
|
|
29
|
+
}
|