npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

giphy-search-web-component

v0.0.2

Published

This web component searches and shows animated Gif's from the GIPHY public API in an infinite scroll container.

Downloads

4

Readme

Built With Stencil

Giphy Search Web Component

This web component searches and shows animated Gif's from the GIPHY public API in an infinite scroll container.

The usage of Stenciljs for generating the Web Component brings the possibility of, instead of only an stand-alone application, to use it also as a widget in any website/application. And it is IE11+ compatible! :D

It will load 10 Gif's at a time, incrementing the page every time the scroll reaches the bottom of the page. You can change the amount of gifs per page setting the property gif-per-page on the component.

Getting Started

To start building the Giphy Search component, clone this repo to a new directory:

git clone https://github.com/fabriciomendonca/giphy-search-webcomponent.git giphy-search-webcomponent
cd giphy-search-webcomponent
git remote rm origin

and run:

npm install
npm start

To build the component for production, run:

npm run build

To run the unit tests for the components, run:

npm test

Running the dev server

To run the development environtment, just run npm start after running npm install.

It will open the browser with HMR on port (default) 3333.

Usage

Serving the JS File

Clone this repo.

git clone https://github.com/fabriciomendonca/giphy-search-webcomponent.git giphy-search-webcomponent
cd giphy-search-webcomponent
git remote rm origin

After building the project for production with npm run build, you can coppy the /dist folder to your server.

<script src="/component_pro_folder/giphysearch.js"></script>
<gs-gifsearch api-key="YOR_GIPHY_API_KEY" gifs-per-page="10">

As a dependency for React or VueJS

Install the Giphy Search Web Component as a dependency.

npm i -S giphy-search-web-component

For React apps, edit your index.js file

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

// Add this line to import the component loader
import { defineCustomElements } from 'giphy-search-web-component/dist/loader';

ReactDOM.render(<App />, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();

// Add this line to define the component on the window scope
defineCustomElements(window);

And use it as an HTML custom tag on your JSX files

import React, { Component } from 'react';

class App extends Component {
  render() {
    return (
      <div className='App'>
        <gs-gifsearch api-key='YOUR_API_KEY' gifs-per-page='10' />
      </div>
    );
  }
}

export default App;

See Stenciljs docs for integration with other frameworks and libraries at https://stenciljs.com/docs/overview

Next steps for this project

  • Improve performance of the infinite scroll, rendering only a small set of the loaded pages and discarding elements that is too far away from what is being shown;
  • Add more actions to the actions bar in the bottom of each gif, like copy link, share and so on;
  • Create option to show the list in a three columns per row way.

GIPHY API Docs

https://developers.giphy.com/docs/