@hackney/social-care-search

Reusable front-end search components for Hackney's social care programme

Usage no npm install needed!

<script type="module">
  import hackneySocialCareSearch from 'https://cdn.skypack.dev/@hackney/social-care-search';
</script>

README

LBH Social care search

Reusable front-end components for front-end search.

It contains:

  • some TypeScript enums and interfaces to make it easier to work with search
  • a useSearch hook that connects up to the api and makes it easier to fetch and manage your results
  • a <SearchBox/> component, looking like this, which will let you search any kind of results (or all of them) and return autocomplete suggestions, or just send the user to the results page
  • a <SearchBoxHeader/> component, which wraps the preceding component in a wrapper that means it can be added to our apps as a header link, giving us a much better unified nav experience

Getting started

First, install it:

npm i @hackney/social-care-search

And you can import the components like:

import { SearchBox } from "@hackney/social-care-search"
import { SearchBoxHeader } from "@hackney/social-care-search"
import { useSearch } from "@hackney/social-care-search"

You will need URLs for the search API and/or the search results page, which are passed as props to most components.