react-icons/bi#BiSearchAlt TypeScript Examples

The following examples show how to use react-icons/bi#BiSearchAlt. 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: Nav.tsx    From Intro_to_React with GNU General Public License v2.0 6 votes vote down vote up
Nav = () => {
  return (
    <aside>
      {icons.map((Icon, index) => (
        <div key={index} className={Icon === BiSearchAlt ? styles.selected : styles.unselected}>
          <Icon />
        </div>
      ))}
    </aside>
  )
}
Example #2
Source File: Nav.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
icons = [BiSearchAlt, BiHomeAlt, BiLeftArrowAlt, BiMusic]
Example #3
Source File: Search.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
Main = () => {
  const [data, setData] = useState([])
  const [message, setMessage] = useState("Let's search something ;)")
  const searchInput = useRef<HTMLInputElement>(null)

  const callAPI = async (queryLiteral: string) => {
    let query = "query=" + queryLiteral
    let url = baseURL + `/v2.2/search/verbose?${key}&${query}`

    let response = await fetch(url)
    let json = await response.json()
    console.log(json)

    setMessage("")
    setData(json.search.data.tracks)
  }

  const search = () => {
    setData([])
    setMessage("Loading ...")

    const queryLiteral = searchInput.current?.value
    callAPI(queryLiteral ?? "")
  }

  return (
    <>
      <form
        onSubmit={e => {
          search()
          e.preventDefault()
          return false
        }}
      >
        <section className={styles.area}>
          <div className={styles.iconWrapper} onClick={search}>
            <BiSearchAlt />
          </div>
          <input className={styles.search} ref={searchInput} />
        </section>
      </form>

      {message !== "" ? (
        <h2 className={styles.message}>{message}</h2>
      ) : (
        <div className={styles.container}>
          {data.map(({ albumName, name, previewURL }) => (
            <article key={name + albumName} className={styles.track}>
              <section className={styles.info}>
                <p>{albumName}</p>
                <h2>{name}</h2>
              </section>

              <audio controls>
                <source src={previewURL} type="audio/mpeg" />
              </audio>
            </article>
          ))}
        </div>
      )}
    </>
  )
}
Example #4
Source File: Search.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
Search: React.FC<{
  setSong: (arg0: song) => void
  state: HTMLMediaState
  controls: HTMLMediaControls
  songInfo: song
}> = ({ songInfo, setSong, state, controls }) => {
  const [data, setData] = useState([])
  const [message, setMessage] = useState("Let's search something ;)")
  const searchInput = useRef<HTMLInputElement>(null)

  const callAPI = async (queryLiteral: string) => {
    let query = "query=" + queryLiteral
    let url = baseURL + `/v2.2/search/verbose?${key}&${query}`

    let response = await fetch(url)
    let json = await response.json()
    console.log(json)

    setMessage("")
    setData(json.search.data.tracks)
  }

  const search = () => {
    setData([])
    setMessage("Loading ...")

    const queryLiteral = searchInput.current?.value
    callAPI(queryLiteral ?? "")
  }

  return (
    <>
      <form
        onSubmit={e => {
          search()
          e.preventDefault()
          return false
        }}
      >
        <section className={styles.area}>
          <div className={styles.iconWrapper} onClick={search}>
            <BiSearchAlt />
          </div>
          <input className={styles.search} ref={searchInput} placeholder="Search something!" />
        </section>
      </form>

      {message !== "" ? (
        <h2 className={styles.message}>{message}</h2>
      ) : (
        <div className={styles.container}>
          {data.map(({ albumName, name, previewURL }) => (
            <Result
              key={name + albumName}
              setSong={setSong}
              album={albumName}
              song={name}
              url={previewURL}
              songInfo={songInfo}
              state={state}
              controls={controls}
            />
          ))}
        </div>
      )}
    </>
  )
}
Example #5
Source File: Search.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
Search: React.FC<{
  setSong: (arg0: song) => void
  state: HTMLMediaState
  controls: HTMLMediaControls
  songInfo: song
}> = ({ songInfo, setSong, state, controls }) => {
  const [data, setData] = useState([])
  const [message, setMessage] = useState("Let's search something ;)")
  const searchInput = useRef<HTMLInputElement>(null)

  const callAPI = async (queryLiteral: string) => {
    let query = "query=" + queryLiteral
    let url = baseURL + `/v2.2/search/verbose?${key}&${query}`

    let response = await fetch(url)
    let json = await response.json()
    console.log(json)

    setMessage("")
    setData(json.search.data.tracks)
  }

  const search = () => {
    setData([])
    setMessage("Loading ...")

    const queryLiteral = searchInput.current?.value
    callAPI(queryLiteral ?? "")
  }

  return (
    <>
      <form
        onSubmit={e => {
          search()
          e.preventDefault()
          return false
        }}
      >
        <section className={styles.area}>
          <div className={styles.iconWrapper} onClick={search}>
            <BiSearchAlt />
          </div>
          <input className={styles.search} ref={searchInput} placeholder="Search something!" />
        </section>
      </form>

      {message !== "" ? (
        <h2 className={styles.message}>{message}</h2>
      ) : (
        <div className={styles.container}>
          {data.map(({ albumName, name, previewURL }, index) => (
            <Result
              key={index}
              setSong={setSong}
              album={albumName}
              song={name}
              url={previewURL}
              songInfo={songInfo}
              state={state}
              controls={controls}
            />
          ))}
        </div>
      )}
    </>
  )
}
Example #6
Source File: SidebarLayout.tsx    From pagely with MIT License 4 votes vote down vote up
SidebarLayout: React.FC<{
  activeTab: 'code' | 'setup' | 'pages' | 'settings' | 'seo';
  title?: string;
}> = ({ activeTab, title, ...props }) => {
  const { emailAddresses, profileImageUrl, fullName, firstName } = useUser();
  const { signOut } = useClerk();

  const router = useRouter();
  const { data } = useClerkSWR<notionSites>(
    `/api/getSiteData/notion/?siteId=${router.query.notionId}`
  );
  return (
    <div>
      <div className='block lg:hidden'>
        <DashboardNav />
        <Head>
          <title>
            {title ||
              data?.siteName +
                ' - ' +
                activeTab.charAt(0).toUpperCase() +
                activeTab.slice(1) +
                ' | ' +
                'Pagely'}
          </title>
        </Head>
      </div>
      <div className='lg:flex'>
        {/* <div className='sticky top-0 overflow-y-hidden'> */}
        <div
          style={{ position: 'sticky' }}
          className='absolute top-0 h-screen left-0 px-10 py-5 bg-gray-50 w-[20vw] border-r hidden flex-col justify-between lg:flex'>
          <div>
            <Link href='/dashboard'>
              <a>
                <small className='text-gray-700 hover:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-700'>
                  {' '}
                  {'<'}- Go back
                </small>
              </a>
            </Link>
            <ul className='mt-10'>
              <li
                className={`my-2 rounded ${
                  activeTab === 'setup' ? ' bg-gray-200' : ' hover:bg-gray-300'
                }`}>
                <Link href={'/notion-site/' + data?.id}>
                  <a className='block px-3 py-2 my-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-700'>
                    {' '}
                    <GoInbox className='relative inline-block bottom-[2px]' />{' '}
                    Setup
                  </a>
                </Link>
              </li>
              <li
                className={`my-2 rounded ${
                  activeTab === 'seo' ? ' bg-gray-200' : ' hover:bg-gray-300'
                }`}>
                <Link href={`/notion-site/${data?.id}/seo`}>
                  <a className='block px-3 py-2 my-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-700'>
                    {' '}
                    <BiSearchAlt className='relative inline-block bottom-[2px]' />{' '}
                    SEO
                  </a>
                </Link>
              </li>
              <li
                className={`my-2 rounded ${
                  activeTab === 'code' ? ' bg-gray-200' : ' hover:bg-gray-300'
                }`}>
                <Link href={`/notion-site/${data?.id}/code`}>
                  <a className='block px-3 py-2 my-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-700'>
                    {' '}
                    <BiCode className='relative inline-block bottom-[2px]' />{' '}
                    Code injection
                  </a>
                </Link>
              </li>
              <li
                className={`my-2 rounded ${
                  activeTab === 'pages' ? ' bg-gray-200' : ' hover:bg-gray-300'
                }`}>
                <Link href={`/notion-site/${data?.id}/pages`}>
                  <a className='block px-3 py-2 my-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-700'>
                    {' '}
                    <HiOutlineNewspaper className='relative inline-block bottom-[2px]' />{' '}
                    Pages
                  </a>
                </Link>
              </li>
              <li
                className={`my-2 rounded ${
                  activeTab === 'settings'
                    ? ' bg-gray-200'
                    : ' hover:bg-gray-300'
                }`}>
                <Link href={`/notion-site/${data?.id}/settings`}>
                  <a className='block px-3 py-2 my-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-700'>
                    {' '}
                    <FiSettings className='relative inline-block bottom-[2px]' />{' '}
                    Settings
                  </a>
                </Link>
              </li>
            </ul>
          </div>
          <ProfileDropdown
            emailAddresses={emailAddresses}
            profileImageUrl={profileImageUrl}
            fullName={fullName}
            firstName={firstName}
            signOut={signOut}
          />
        </div>
        <div className='mx-10 mt-20'>{props.children}</div>
      </div>
      <Toaster />
    </div>
  );
}