GithubHelp home page GithubHelp logo

beembarik / claps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from upstash/claps

0.0 0.0 0.0 103 KB

Adds clap button (like medium) to any page for your Next.js apps.

Home Page: https://upstash-claps.vercel.app/

License: MIT License

JavaScript 1.23% TypeScript 84.35% CSS 14.42%

claps's Introduction

@upstash/claps

Add a claps button (like medium) to any page for your Next.js apps.

Nothing to maintain, it is completely serverless ๐Ÿ’ฏ

Check out the demo.

1. Create Database

Create a free Redis database at Upstash Console

We will use Upstash Redis to keep the data as well as messaging (Redis pub/sub).

2. Environment Variables

Copy the .env.local.example file to .env.local (which will be ignored by Git):

cp .env.local.example .env.local

UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN can be found at the database details page in Upstash Console.

3. Install Package

yarn add @upstash/claps

4. Import CSS

// pages/_app.js
import "@upstash/claps/style.css";

export default function MyApp({ Component, pageProps }) {
  return <Component {...pageProps} />;
}

4. Import Components

// pages/example.js
import Claps from "@upstash/claps";

export default function Example() {
  return (
    <div>
        <Claps fixed="left">
    </div>
  )
}

The options can be passed as React props

key type default
key? string
fixed? "left", "center", "right"
replyUrl? string
replyCount? string
apiPath? string /api/claps
iconClap? null, React.ReactElement
iconReply? null, React.ReactElement

Url of the page is being used as the key/identity to keep the claps count. You can override this giving the key attribute.

5. Create API

// pages/api/claps.js
import createClapsAPI from "@upstash/claps/api";

const ClapsAPI = createClapsAPI({
 // maxClaps: 10
});
export default ClapsAPI;

Support

Use Upstash Discord channel to get support.

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.