add search section to home
This commit is contained in:
31
ArtisanConnect/components/SearchSection.jsx
Normal file
31
ArtisanConnect/components/SearchSection.jsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Input, InputField, InputIcon, InputSlot } from "@/components/ui/input"
|
||||
import { SearchIcon } from "@/components/ui/icon"
|
||||
import { Box } from "@/components/ui/box"
|
||||
import { useRouter } from "expo-router";
|
||||
|
||||
export function SearchSection({ searchQuery, setSearchQuery }) {
|
||||
const router = useRouter();
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
const value = e.nativeEvent.text;
|
||||
router.push({
|
||||
pathname: "/notices",
|
||||
params: { search: value }
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Box className="m-2 bg-white">
|
||||
<Input>
|
||||
<InputSlot>
|
||||
<InputIcon as={SearchIcon} />
|
||||
</InputSlot>
|
||||
<InputField placeholder="Wyszukaj.."
|
||||
value={searchQuery}
|
||||
onChangeText={setSearchQuery}
|
||||
onSubmitEditing={handleSubmit}
|
||||
returnKeyType="search" />
|
||||
</Input>
|
||||
</Box>
|
||||
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user