Skip to content

soub4i/react-spotifycode

Repository files navigation

@soubai/react-spotifycode

spotify:user:spotify:playlist:37i9dQZF1DXcBWIGoYBM5M

React library for Spotify codes

Spotify Code is a QR-like “scannable” tag that can be used to quickly share or access a piece of content within Spotify

NPM JavaScript Style Guide

Install

npm install --save @soubai/react-spotifycode

Usage

import React, { Component } from 'react'

import SpotifyCode from '@soubai/react-spotifycode'

class Example extends Component {
  render() {
    return (
      <SpotifyCode code='spotify:user:spotify:playlist:37i9dQZF1DXcBWIGoYBM5M' />
    )
  }
}

Props

The component accept a few props:

  • code: The Spotify URI - required
  • format The image format - 'jpeg' | 'png' | 'svg' - default : 'jpeg'
  • barColor: Bar color - 'black' | 'white' - default : 'black'
  • backgroundColor: The background color - default : '000' - example : '000' or '000000' for #000 color
  • size: The image size on pixel - default : 640

Development

Local development is broken into two parts (ideally using two tabs).

First, run rollup to watch your src/ module and automatically recompile it into dist/ whenever you make changes.

npm start # runs rollup with watch flag

The second part will be running the example/ create-react-app that's linked to the local version of your module.

# (in another tab)
cd example
npm start # runs create-react-app dev server

License

MIT © AbderrahimSoubaiElidrissi

Releases

No releases published

Packages

No packages published