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

demoup-react

v0.3.0

Published

React components for integrating the demoup video player solution in react based websites

Downloads

5,036

Readme

demoup-react

Place the DemoUp playbutton as a normal react component at the intendend position in your page.

Usage

var DemoUpButton = require('demoup-react')("yourshop.domain").button;

var exampleComponent = function() {
	return <DemoUpButton />
}

Note that the Button is not rendered immediatly. The component will load some shop specific code and check, whether there is actually a video for the current page. It will render the button afterwards in case there are video available. Be prepared that the button is inserted after the page is already rendered.

Configuration

You can configure the components by passing props. The following props are currently supported:

Button

<DemoUpButton
	buttonheight = {30} // Overwrite the height of play image. Default is set by DemoUp specific for each shop.
	buttonwidth = {30} // Overwrite the width of play image. Default is set by DemoUp specific for each shop.
	color = "#FFF" // Overwrite the color of the play image in the button. Default is set by DemoUp specific for each shop.
	height = {60} // Overwrite the height of the button container in pixels. Default is set by DemoUp specific for each shop.
	multibutton = {false} // Should multiple videos displayed as one or several buttons behind each other? true/false Default: false
	width = {60} // Overwrite the width of the button container in pixels. Default is set by DemoUp specific for each shop.
	mode = "production" // If not set the component will detect "Node.env" environment variable and choose to either load the local/staging or production version. By default this is staging. To overwrite this detection use this parameter to explicitly set the system into production mode.

	/* The following option turns off the automatic video detection of DemoUp. Use it similiar as a Youtube embed where you want a specific video at a specific place.
	This is NOT to be used when doing an integration into the product page
	 */
	mid = "OW6Qd26Sdx" // Select a specific video by using a known movie identifier. Movie identifier can be found in the DemoUp dashboard
/>

Container

Additionally to the known button component, there is also a button container element available. It was developed in order to give your components the possibilty to know how many videos there are. The child component in this case "MyChildComponent" will receive a property "videosAvailable" which contains the number of available videos, together with "videos".

  <DemoUpContainer mode="production" threed="enabled" url="https://www.myshop.com/pdp">
    <MyChildComponent />
  </DemoUpContainer>

You component "MyChildComponent" might then look like this, in order to render the video buttons

render(){
    /* Through the properties you will get two main information: 
    /* videosAvailable: The number of videos which were found and selected based on the langugae configuration
    /* videos: A list of unique video ids you can use them to iterate over the array and create play buttons. 
    /* Each playbutton can be assign to an individual video. Moreover you can specify where to playback the video, 
    /* as already know of the former React component version. */
    let buttonsToShow = <></>;
    if(this.props.videos){

        buttonsToShow = this.props.videos.map( aVideo =>{
            return <DemoUpButton mid={aVideo} key={aVideo} playerAttrs={{ title: "Watch video" }} triggerCallback={cb => this.playVideo(cb)}></DemoUpButton>;
        });
    }

    return <div>This is an example for a thumbnail container, which has currently <b> {this.props.videosAvailable} </b> videos to show.
        <div id="demoup-thumbnail-list">
            {buttonsToShow}
        </div>
        
        <h2>Here the video will be displayed.</h2>
        <div id="demoup-playback-div"></div>
    </div>;
}

3D Support

By default 3D is disabled, to enable it you have to set the property threed="enabled" either in the button or container component.

Changelog

  • 0.3.0 Upgrade to React 18
  • 0.2.6 Made the mode configurable
  • 0.2.5 Changed default mode to staging
  • 0.2.4 Added support for 3D Videos

License

MIT.