Skip to content

Commit 1f7bc19

Browse files
committed
add algolia search icon
1 parent 589dfdc commit 1f7bc19

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

components/SearchSection.tsx

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
"use client";
2+
3+
import { SearchIcon } from "lucide-react";
14
import React, { useEffect } from "react";
2-
import { SearchBox, useInstantSearch, useSearchBox } from "react-instantsearch";
5+
import {
6+
SearchBox,
7+
useInstantSearch,
8+
useSearchBox,
9+
PoweredBy,
10+
} from "react-instantsearch";
311

412
export function SearchSection() {
513
const { results } = useInstantSearch({});
@@ -8,35 +16,37 @@ export function SearchSection() {
816
useEffect(() => {
917
console.log(results);
1018
}, [results]);
19+
1120
return (
1221
<div id="search" className="mb-8 max-w-3xl mx-auto">
13-
<div className="relative">
14-
<div className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none z-10">
15-
<svg
16-
className="h-5 w-5 text-gray-400"
17-
fill="none"
18-
stroke="currentColor"
19-
viewBox="0 0 24 24"
20-
>
21-
<path
22-
strokeLinecap="round"
23-
strokeLinejoin="round"
24-
strokeWidth={2}
25-
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
22+
<div className="border-2 border-gray-200 rounded-xl transition-all duration-200 shadow-sm hover:shadow-md">
23+
<div className="flex items-center">
24+
<div className="relative flex-1">
25+
<div className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none z-10">
26+
<SearchIcon className="h-5 w-5 text-gray-400" />
27+
</div>
28+
<SearchBox
29+
placeholder={`Search through APIs...`}
30+
classNames={{
31+
form: "relative",
32+
input:
33+
"w-full pl-12 pr-4 py-2 text-lg border-0 bg-transparent focus:outline-none",
34+
submit: "hidden",
35+
reset: "hidden",
36+
loadingIndicator: "hidden",
37+
}}
38+
/>
39+
</div>
40+
<div className="flex items-center pr-4 border-l border-gray-200 ml-2 pl-4">
41+
<PoweredBy
42+
classNames={{
43+
root: "text-sm text-gray-500",
44+
link: "text-blue-600 hover:text-blue-800 no-underline",
45+
logo: "h-4 w-auto ml-1",
46+
}}
2647
/>
27-
</svg>
48+
</div>
2849
</div>
29-
<SearchBox
30-
placeholder={`Search through APIs...`}
31-
classNames={{
32-
form: "relative",
33-
input:
34-
"w-full pl-12 pr-4 py-2 text-lg border-2 border-gray-200 rounded-xl transition-all duration-200 shadow-sm hover:shadow-md",
35-
submit: "hidden",
36-
reset: "hidden",
37-
loadingIndicator: "hidden",
38-
}}
39-
/>
4050
</div>
4151
{query && (
4252
<div className="mt-3 text-lg text-gray-600 text-center">

0 commit comments

Comments
 (0)