react-icons/go#GoSearch JavaScript Examples

The following examples show how to use react-icons/go#GoSearch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Header.js    From hackertab.dev with Apache License 2.0 6 votes vote down vote up
function SearchBar({ state }) {
  const keywordsInputRef = React.useRef(null)
  const userSearchEngine = SUPPORTED_SEARCH_ENGINES.find(
    (engine) => engine.label == state.searchEngine
  )

  const handleSubmit = (e) => {
    e.preventDefault()
    const keywords = e.target.children[1].value
    trackSearch(userSearchEngine.label)
    window.open(`${userSearchEngine.url}${keywords}`, '_self')
  }

  useEffect(() => {
    keywordsInputRef.current.focus()
  }, [])

  return (
    <form className="searchBar" onSubmit={handleSubmit}>
      <GoSearch className="searchBarIcon" size={20} />
      <input
        ref={keywordsInputRef}
        type="text"
        className="searchBarInput"
        placeholder={`Search on ${userSearchEngine.label}`}
      />
    </form>
  )
}
Example #2
Source File: Region.js    From covid19 with MIT License 5 votes vote down vote up
render() {
        const { isOpen, value, countryOnly } = this.state
        if (this.props.data == null) return

        const MoreIcon = countryOnly ? GoUnfold : GoFold

        return (
            <div className="current-region-wrap">
                <RegionDropdown
                    isOpen={isOpen}
                    onClose={this.toggleOpen}
                    target={
                        <div className="current-region" onClick={this.toggleOpen}>
                            <div
                                data-tip={this.displayRegionName()}
                                data-tip-disable={this.showTooltip()}
                                data-place={'bottom'}
                            >
                                {this.displayRegionName()}
                            </div>
                            <GoSearch size={18} className="dropdown-arrow" style={{ transform: 'translateY(1px)' }} />
                        </div>
                    }
                >
                    <Select
                        classNamePrefix={'region-select'}
                        autoFocus
                        backspaceRemovesValue={false}
                        components={{
                            DropdownIndicator: () => (
                                <span
                                    className="region-select-more"
                                    onMouseUp={this.toggleCountryOnly}
                                    onTouchEnd={this.toggleCountryOnly}
                                    onMouseEnter={() => this.props.ReactTooltip.show(this.regionSelectMore)}
                                    onMouseLeave={() => this.props.ReactTooltip.hide(this.regionSelectMore)}
                                    ref={(ref) => (this.regionSelectMore = ref)}
                                    data-tip={
                                        countryOnly ? (
                                            i18n.MORE_REGIONS_HELP_TEXT[this.props.lang]
                                        ) : (
                                            i18n.LESS_REGIONS_HELP_TEXT[this.props.lang]
                                        )
                                    }
                                >
                                    <MoreIcon
                                        size={16}
                                        color={
                                            this.props.darkMode ? 'var(--primary-color-4)' : 'var(--primary-color-5)'
                                        }
                                    />
                                </span>
                            ),
                            IndicatorSeparator: null
                        }}
                        controlShouldRenderValue={false}
                        hideSelectedOptions={false}
                        isClearable={false}
                        menuIsOpen
                        onChange={this.onSelectChange}
                        options={this.state.options}
                        placeholder={`${i18n.SEARCH[this.props.lang]} ...... `}
                        styles={this.props.darkMode ? selectStylesDark : selectStyles}
                        tabSelectsValue={false}
                        value={value}
                        noOptionsMessage={() => i18n.NO_RESULT[this.props.lang]}
                    />
                </RegionDropdown>
                <div className="current-date">{this.displayDate()}</div>
            </div>
        )
    }