The Search Results component encapsulates all components relating to search-results.

Tag

The tag for this component is <hawksearch-search-results>.

Default Template

The following is the default Handlebars template for this component. To create a custom template, it is recommended to use this as a starting point. {@embed ./search-results.component.hbs}

Hierarchy

Constructors

Properties

bindFromEvent: boolean = true
componentName: keyof HawkSearchComponents = 'search-results'

The data bound to the Handlebars template.

The data bound to the component.

defaultHtml: any = defaultHtml
handlebars: typeof Handlebars = HawkSearch.handlebars

The Handlebars reference shared by all HawkSearch components.

Accessors

  • get configuration(): undefined | TConfig
  • The optional configuration object for this component.

    Returns undefined | TConfig

  • get mode(): SearchResultsMode
  • Speficies the context that the component is being used. This is determined by the mode attribute on the HTML element.

    Default Value

    'search-results'

    Returns SearchResultsMode

  • get rootElement(): ParentNode
  • The root element which should be used for querying any child elements. This resolves to this.shadowRoot if the Shadow DOM is enabled, otherwise this.

    Returns ParentNode

  • get url(): string
  • If mode is set to 'landing-page', this specifies the URL sent to retrieve content from HawkSearch. This can be customized by setting the url attribute on the HTML element.

    Default Value

    window.location.pathname

    Returns string

Methods

  • After the component is rendered, this method is called to bind any child components.

    Returns void

  • Replaces placeholders in a given string with values from a data object.

    Returns

    The template string with all placeholders replaced by the values specified in values.

    Parameters

    • template: string

      The template string.

    • values: Record<string, string>

      The object containing properties which will be bound to template.

    Returns string

  • After the component is rendered, this method is called for any additional processing (such as attaching event listeners) which needs to occur.

    Returns void

  • Optional method that can be overwritten to register Handlebars helper functions which can be accessed from the template. For more information, see Custom Helpers.

    Returns void

  • Determines whether the data meets the necessary conditions to perform data binding and render content.

    Returns

    Whether the component should be rendered. If false, the component will have empty contents and be set to display: none;.

    Returns boolean