Skip to content

Commit 3104512

Browse files
committed
Integrate Pagefind search functionality; update package dependencies to version 1.4.0; enhance global styles for search components; refactor SearchBar to utilize PagefindSearch component; improve documentation chapter titles for clarity.
1 parent 36fb2dc commit 3104512

19 files changed

+521
-253
lines changed

app/global.css

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,61 @@
218218
opacity: 0.8;
219219
pointer-events: none;
220220
}
221+
222+
/* Custom Pagefind Search Styles */
223+
.pagefind-search {
224+
position: relative;
225+
z-index: 10000;
226+
}
227+
228+
.pagefind-search-overlay {
229+
position: fixed;
230+
top: 0;
231+
left: 0;
232+
right: 0;
233+
bottom: 0;
234+
background: rgba(0, 0, 0, 0.8);
235+
backdrop-filter: blur(8px);
236+
z-index: 10000;
237+
display: flex;
238+
align-items: flex-start;
239+
justify-content: center;
240+
padding-top: 10vh;
241+
}
242+
243+
.pagefind-search-container {
244+
background: rgba(255, 255, 255, 0.1);
245+
border: 1px solid rgba(255, 255, 255, 0.2);
246+
border-radius: 12px;
247+
backdrop-filter: blur(10px);
248+
min-width: 600px;
249+
max-width: 90vw;
250+
max-height: 80vh;
251+
overflow: hidden;
252+
}
253+
254+
.pagefind-search-input {
255+
background: transparent;
256+
border: none;
257+
outline: none;
258+
color: rgba(255, 255, 255, 0.9);
259+
font-size: 16px;
260+
flex: 1;
261+
min-width: 0;
262+
}
263+
264+
.pagefind-search-result {
265+
padding: 16px 20px;
266+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
267+
cursor: pointer;
268+
transition: background-color 0.2s ease;
269+
}
270+
271+
.pagefind-search-result:hover {
272+
background: rgba(255, 255, 255, 0.1);
273+
}
274+
275+
.pagefind-search-result:last-child {
276+
border-bottom: none;
277+
}
221278
}

app/search/page.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use client'
2+
3+
import { PagefindSearch } from '../../components/SearchBar/PagefindSearch';
4+
5+
export default function SearchPage() {
6+
return (
7+
<div style={{
8+
minHeight: '100vh',
9+
background: 'transparent',
10+
padding: '20px'
11+
}}>
12+
<div style={{ maxWidth: 800, margin: '0 auto' }}>
13+
<h1 style={{
14+
color: 'rgba(255, 255, 255, 0.9)',
15+
marginBottom: '20px',
16+
fontSize: '2rem',
17+
fontWeight: 600
18+
}}>
19+
Search Documentation
20+
</h1>
21+
<PagefindSearch />
22+
</div>
23+
</div>
24+
);
25+
}

components/FloatingAssistant.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function FloatingAssistant() {
4747
const [isAskingQuestion, setIsAskingQuestion] = useState(false);
4848
const [debounceTimer, setDebounceTimer] = useState<NodeJS.Timeout | null>(null);
4949
const [lastSelection, setLastSelection] = useState('');
50-
const [highlightMode, setHighlightMode] = useState(true);
50+
const [highlightMode, setHighlightMode] = useState(false);
5151
const [showSettings, setShowSettings] = useState(false);
5252

5353
// Function to check if element is within a code editor
@@ -185,6 +185,17 @@ Please:
185185
setQuestion('');
186186
};
187187

188+
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
189+
if (e.key === 'Enter' && !e.shiftKey) {
190+
e.preventDefault();
191+
if (question.trim()) {
192+
setIsAskingQuestion(true);
193+
getExplanation(selectedText || '', question);
194+
setQuestion('');
195+
}
196+
}
197+
};
198+
188199
return (
189200
<>
190201
<div
@@ -684,6 +695,7 @@ Please:
684695
: "Ask any question..."}
685696
value={question}
686697
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => setQuestion(e.target.value)}
698+
onKeyDown={handleKeyDown}
687699
style={{ flex: 1 }}
688700
disabled={isLoading}
689701
autosize

components/MantineNavBar/MantineNavBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const MantineNavBar = () => {
2020
return (
2121
<>
2222
<MantineNextraThemeObserver />
23-
<Box style={{ position: 'sticky', top: 0, zIndex: 50 }}>
23+
<Box>
2424
<Header />
2525
</Box>
2626
</>

0 commit comments

Comments
 (0)