Giter Club home page Giter Club logo

svelte-tenor's Introduction

svelte-tenor

Tenor GIF components, implemented in Svelte.

package version downloads per week npm bundle size

A lot of cat GIFs

Try svelte-tenor

Try svelte-tenor here!

The all-in-one GIF keyboard

Install svelte-tenor with your favorite package manager:

npm install svelte-tenor
# or
yarn add svelte-tenor

Use the MobileKeyboard component:

<script>
  import { MobileKeyboard, Gif } from 'svelte-tenor'

  let gif
</script>

<MobileKeyboard
  key="Get a key for free here: https://tenor.com/developer/keyregistration"
  on:click={({ detail }) => {
    gif = detail
  }}
/>

{#if gif !== undefined}
  <p><Gif {gif} /></p>
  <pre>{JSON.stringify(gif, null, 2)}</pre>
{/if}

image
Open this example in your browser

Component list

If you want to build your own GIF keyboard, svelte-tenor contains a lot of components.

Autocomplete: offers to finish your sentence
Autocomplete example

Categories: Tenor GIF categories
GIF categories: dance, annoyed, omg...

Search: asks Tenor for matching GIFs
Searching cat GIFs

And more! Try all available components: https://gauben.github.io/svelte-tenor/storybook/

Build your own keyboard

While MobileKeyboard might be enough for prototyping, you probably want to create a GIF keyboard with more features and a better design. To help you do so, svelte-tenor contains a handful of composable components.

If you don't know how or where to begin, you may read the source code of MobileKeyboard.

Typed API

All the components above use Tenor API. The API client implementation is written in TypeScript and fully typed. You can use it as follows:

import { search } from 'svelte-tenor/api'

console.log(await search({ key: 'LIVDSRZULELA', q: 'hello' }))

Open this example in your browser

The API runs smoothly in the browser and deno, but requires a workaround in node:

// https://www.npmjs.com/package/node-fetch
import fetch from 'node-fetch'
Object.defineProperties(globalThis, {
  fetch: { enumerable: true, configurable: true, value: fetch },
})

Please note that the API implemented does not completely follow Tenor's documentation. If you want a faithful API implementation, use svelte-tenor/raw-api instead.

How to contribute?

Install Node and Yarn with Volta. Once you've cloned the project and installed dependencies with yarn install, start a development server:

# Start Storybook
yarn storybook

# Format code with prettier
yarn format

# Run code quality checks
yarn check

# Commit your changes!
git commit -a

If everything works, please open a pull request with your changes and a short description. Thanks for considering contributing!

License

MIT

svelte-tenor's People

Contributors

gauben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

svelte-tenor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.