1.1.7 • Published 2 years ago

casted-react-search v1.1.7

Weekly downloads
26
License
MIT
Repository
github
Last release
2 years ago

casted-react-search

A React component to search Casted account content

NPM JavaScript Style Guide

Install

npm install --save casted-react-search

Usage

import React, { useState } from 'react'

import { SearchInput, SearchResults } from 'casted-react-search'
import 'casted-react-search/dist/index.css'

const ExampleComponent = () => {
  const [isSearchOpen, setIsSearchOpen] = useState(false)

  // The history value should be pulled in from router library
  const history = null

  return (
    <>
      <SearchInput onClick={() => setIsSearchOpen(true)} />
      <SearchResults
        searchKey='elastic-search-key'
        engineName='elastic-engine-name'
        endpointBase='elastic-endpoint-base'
        history={history}
        onResultClick={() => setIsSearchOpen(false)}
      />
    </>
  )
}

Development

When needing to develop this library, you can utilize the test environment located in /example. The test environment will automatically pull in the casted-react-search library.

To build casted-react-search, run:

npm run build

To build and watch casted-react-search, run:

npm run start

License

MIT © maindaniel