Skip to content

Instantly share code, notes, and snippets.

@tushar30
Last active November 13, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tushar30/230acd37cb064c75c1e6a03b9e0159d1 to your computer and use it in GitHub Desktop.
Save tushar30/230acd37cb064c75c1e6a03b9e0159d1 to your computer and use it in GitHub Desktop.
<aura:component controller="CustomSearchController" implements="forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="searchText" type="String" default=""/>
<aura:attribute type="list" name="recordList" />
<aura:attribute name="Label" type="String"/>
<aura:attribute name="required" type="Boolean" default="false"/>
<lightning:card iconName="utility:search" title="Global Search">
<div class="slds-form-element__control slds-input-has-icon slds-input-has-icon slds-input-has-icon_left-right" role="none">
<lightning:input required="{!v.required}" aura:id="userinput" label="{!v.Label}" name="searchText" onchange="{! c.handleClick }" value="{!v.searchText}" class="leftspace"/>
<span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right iconheight">
<lightning:icon class="slds-icon slds-icon slds-icon_small slds-icon-text-default" iconName="utility:search" size="x-small" alternativeText="icon" />
</span>
</div>
<aura:if isTrue="{!and(v.recordList.length == 0 , v.searchText)}">
No result found.
<aura:set attribute="else">
<c:customSearchResultsList recordList="{!v.recordList}"/>
</aura:set>
</aura:if>
</lightning:card>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment