Giter Site home page Giter Site logo

andyyou / react-coverflow Goto Github PK

View Code? Open in Web Editor NEW
345.0 9.0 142.0 14.31 MB

A Coverflow effect component of React version made for the web.

Home Page: http://andyyou.github.io/react-coverflow/

License: MIT License

HTML 15.93% JavaScript 76.77% Makefile 0.18% SCSS 7.00% Nix 0.13%
coverflow react hacktoberfest-accepted

react-coverflow's Introduction

Looking for someone to take over the project as I've recently changes jobs and had a child and am no longer capable of supporting this dependency. If anyone is interested, please feel free to take ownership of it

React Coverflow

npm version

NPM


React Coverflow is a React component for building cover flow style carousel in a convenient way.

Features of react-coverflow

  • Flexbox styles of CSS 3.
  • Support scroll in the component.
  • Support navigation buttons optional
  • Using css-module
  • Support mobile

Getting started

Install react-coverflow using npm.

$ npm install react-coverflow

The required stylesheet using css-module and include in package(js file), so you don't need include other stylesheet.

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import Coverflow from 'react-coverflow';

const fn = function () {
  /* do your action */
}

ReactDOM.render(
  <Coverflow width="960" height="500" classes={{background: 'rgb(233, 23, 23)'}} className=''
    displayQuantityOfSide={2}
    navigation={false}
    enableScroll={true}
    clickable={true}
    active={0}
  >
    <div
      onClick={() => fn()}
      onKeyDown={() => fn()}
      role="menuitem"
      tabIndex="0"
    >
      <img
        src='image/path'
        alt='title or description'
        style={{
          display: 'block',
          width: '100%',
        }}
      />
    </div>
    <img src='image/path' alt='title or description' data-action="http://andyyou.github.io/react-coverflow/"/>
    <img src='image/path' alt='title or description' data-action="http://andyyou.github.io/react-coverflow/"/>
  </Coverflow>,

  document.querySelector('.content')
);

In order to pass functions to the images, you can simply wrap the <img /> in a <div>. You should make sure to give your img specific styling properties to confine it to the parent div.

For more examples, on how to use React Coverflow, please visit http://andyyou.github.io/react-coverflow/

Properties

Name Type Default Description
children node should be <img /> nodes
infiniteScroll boolean false Allows the carousel to scroll from the last image to the (upon clicking the next button) or from the first to the last (by clicking the previous button). infiniteScroll is not supported by mouse scrolling.
displayQuantityOfSide number The number of display image from center to the one side end.
navigation boolean false Enable navigation arrows. This will disable image-click navigation.
enableHeading boolean true Shows the img alt as the label for the img.
enableScroll boolean true Enable scrolling feature.
media object To support media query, if you want responsive with parent element you can ignore width and height props or set it to auto.
active number middle child node The index of the image you want to be active.
clickable boolean true Makes images clickable, setting to false will disable clickability of images.
currentFigureScale number 1.5 The scale factor (float) to be applied on the active image.
otherFigureScale number .8 The scale factor (float) to be applied on the inactive images.
classes object To support style changes for customization.
className string To add css class to the coverflow to customize.

Responsive

Now, you can use media props to support responsive design. The syntax part is come form Radium You can reference to this doc.

  • 2016-09-13 If you need RWD you should add <StyleRoot>
ReactDOM.render(
  <StyleRoot>
    <Coverflow
      displayQuantityOfSide={2}
      navigation={true}
      enableHeading={true}
      active={0}
      media={{
        '@media (max-width: 900px)': {
          width: '600px',
          height: '300px'
        },
        '@media (min-width: 900px)': {
          width: '960px',
          height: '600px'
        }
      }}
      >
      <img src='images/album-1.png' alt='Album one' data-action="https://facebook.github.io/react/"/>
      <img src='images/album-2.png' alt='Album two' data-action="http://passer.cc"/>
      <img src='images/album-3.png' alt='Album three' data-action="https://doce.cc/"/>
      <img src='images/album-4.png' alt='Album four' data-action="http://tw.yahoo.com"/>
    </Coverflow>
  </StyleRoot>
  ,
  document.querySelector('.example_2')
);

Contributors

Use Github issues for requests

react-coverflow is a community project and wouldn't be what it is without contributions! We encourage and support contributions. The react-coverflow source code is released under the MIT License.

Feel free to fork and improve/enhance react-coverflow any way you want. If you feel that react-coverflow will benefit from your changes, please open a pull request.

Development

If you want to custom the component there are some commands that can help you.

# Compile component to dist/
$ npm run build-npm

# Build source of site
$ npm run build-site

# Clean
$ npm run clean

# Development Server
$ npm run dev

# Deploy examples to gh-pages
$ npm run build-npm
$ npm run build-site
$ git subtree push --prefix site origin gh-pages
$ npm version patch
$ npm publish

Release History

  • 2019-04-13
    • Removed button navigation for arrow navigation. Using arrow navigation now disables the image-click navigation that had previously existed.
  • 2018-03-04
    • Added Infinite Scrolling Option that allows users to scroll from first to last option continuously using the arrow buttons. Buttons dynamically rendered based on current position of img
  • 2018-02-24
    • Fixed deprecation errors / warnings, updated packages.
  • 2016-09-29
    • Add clickable props to on/off click of image.
  • 2016-09-22
    • Fix issue change active can update current image.
  • 2016-09-16
    • Add keypress events for prev/next
  • 2016-09-13
    • Fix Unknown Prop Warning
    • Radium updated that if you need RWD feature you need to wrap <StyleRoot>
    • Remove img url attribute, use data-action instead. when value is string will redirectin url otherwise can put function will be execute.
    • Add active attribute
  • 2016-09-10
    • Use postcss-loader instead of autoprefixer-loader
    • Update babel to v6+
  • 2015-12-12 Fix React 0.14.3 two copies issue
  • 2015-12-10 Update React version.
  • 2015-11-13
    • v0.1.9 Support responsive props.
    • Update eslint with babel-eslint.
  • 2015-11-11
    • v0.1.8 Fix some issues and add option to enable/disable scroll ability.
    • Add displayName to fix react-devtool show t tag.
  • 2015-11-10
    • v0.1.6 Support react 0.14.2
  • 2015-10-09
    • v0.1.4 Add propTypes and enableHeading options for mobile.
    • Add example of responsive.
  • 2015-10-07 v0.1.3 Support even number of images, Fix bugs
  • 2015-09-22 v0.1.0

Issues

  • If you get the errors as follow
Warning: Any use of a keyed object should be wrapped in React.addons.createFragment(object) before being passed as a child. Warning: t(...): React component classes must extend React.Component.

That because of React 0.14.2 got some change and the component not update before.

Error: To use plugins requiring addCSS (e.g. keyframes, media queries), please wrap your application in the StyleRoot component

Todo

  • Write test case
  • Add further customization options
  • Add Prev/Next Arrows instead of Buttons

react-coverflow's People

Contributors

abishek28007 avatar ahmedlhanafy avatar amilajack avatar andyyou avatar asalem1 avatar davitmargaryan avatar dependabot[bot] avatar revgum avatar sacsbrainz avatar startouf avatar themillhousegroup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-coverflow's Issues

Does this work properly with trackpad ?

I m having quite a bad user experience using scroll with trackpad on my macbook pro. Is it supported ?

Its like its scrolling from beginning to end, no matter in what direction i scroll.

set background with centered image

i want to set main container background with image that shown in center of slider, not using background color. every time user change image (scrolled), background change and show that image behind the image as background and blur it, how could i do that?

lib size is enormous 1.07Mb

I'm sorry if it's me doing something wrong (but i doubt it)
But bundle size is huge due to react-coverflow size.
screenshot 2018-12-16 at 14 39 59
In my opinion, it's not ok for carousel library to take 47% of bundle size

Error: The style-loader cannot be used in a non-browser environment

I have installed coverflow and I have MERN stack in use. I get following error whenever I want to start my project by using npm start:

Error: The style-loader cannot be used in a non-browser environment

What's the reason for that issue and how I can solve it? I have been searching on internet but still didn't found any working solution. #

Mobile Images Not Displaying

When I resize for mobile,the <figure> element gets a generated width of 79.4px. This causes the image to hide and only show the text. Is there an option I missed to override that? Thanks! BTW, Beautiful work!

TypeError: Cannot read property 'originalSource' of undefined

Not sure why this is happening when I put down

TypeError: Cannot read property 'originalSource' of undefined
[1] at getSourceById (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/react-dev-utils/evalSourceMapMiddleware.js:18:17)
[1] at handleWebpackInternalMiddleware (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/react-dev-utils/evalSourceMapMiddleware.js:37:22)
[1] at Layer.handle [as handle_request] (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/layer.js:95:5)
[1] at trim_prefix (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:317:13)
[1] at /Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:284:7
[1] at Function.process_params (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:335:12)
[1] at next (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:275:10)
[1] at middleware (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/http-proxy-middleware/lib/index.js:43:7)
[1] at Layer.handle [as handle_request] (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/layer.js:95:5)
[1] at trim_prefix (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:317:13)
[1] TypeError: Cannot read property 'originalSource' of undefined
[1] at getSourceById (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/react-dev-utils/evalSourceMapMiddleware.js:18:17)
[1] at handleWebpackInternalMiddleware (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/react-dev-utils/evalSourceMapMiddleware.js:37:22)
[1] at Layer.handle [as handle_request] (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/layer.js:95:5)
[1] at trim_prefix (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:317:13)
[1] at /Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:284:7
[1] at Function.process_params (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:335:12)
[1] at next (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:275:10)
[1] at middleware (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/http-proxy-middleware/lib/index.js:43:7)
[1] at Layer.handle [as handle_request] (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/layer.js:95:5)
[1] at trim_prefix (/Users/user/Dropbox/CSCI4308SeniorProj/fmngreen/Server/client/node_modules/express/lib/router/index.js:317:13)

Content with links become unclickable

I have a coverflow with nested React components (a clickable <a> card that is supposed to redirect somewhere else)

The coverflow makes the elements scrollable, but once I have the main "cover" in the central view, I'd like to be able to click on it.

class MyCoverflowWrapper {
   ...
   render() { 
       return(
           <Coverflow>
               <Card link={...}>
               <Card link={...}>
            </Coverflow
        )
    }
}

class Card {
    ...
    render() { 
        return(
            <div class="card">
                <a href={this.props.link}>
                    ...
                </a>
             </div>
       )
    }
}

Currently the link is still there but not clickable/ won't change the page

resize listener produces error if component is unmounted/remounted

Issue:
I'm getting an error when I resize (if the component is unmounted/remounted):
Uncaught Error: Unable to find node on an unmounted component. at invariant (invariant.js:42) at findCurrentFiberUsingSlowPath (react-dom.development.js:3552) at findCurrentHostFiber (react-dom.development.js:3621) at Object.findHostInstance (react-dom.development.js:12611) at Object.findDOMNode (react-dom.development.js:16395) at RadiumEnhancer.updateDimensions (CoverFlow.js:124)

Reproduce:

  1. use CoverFlow inside a component.
  2. remove container component (confirm componentWillUnmount occurs)
  3. curiously, notice CoverFlow DOES execute: window.removeEventListener('resize', this.updateDimensions.bind(this));
    4 resize the browser window now that the CoverFlow is gone.
  4. see error above.

I could avoid the issue by never adding the resize to begin with--that is, comment out:
window.addEventListener('resize', this.updateDimensions.bind(this));

Please tell me if there's something I can do to help.

Using different sized images?

Is there any easy way load images of a different size? I've noticed that if I specify a 'height' on the HTML img elements, it does increase the height. However, specifying 'width' on the images has no affect. It appears that in order to make the images wider, you have to make the coverflow component wider

Unable to click on figures

The NPM version is out of sync with the github version. NPM is 4 months old and missing f386a14 which fixed the issue.

Note: cloning the project from github and rebuilding "prepublishOnly" fixes the issue.

multiple copies of react

React is listed as dependency and is creating an issue when it i being used.
Error Details:
image

When searched, I found out that there are multiple versions of react in the the project folder.
image

One of the solution provided for the similar issue is to remove "React" from dependency, instead it should be listed as peer-dependency.

Impossible to create covers dynamically...

Anyone ever created dynamically their covers ?

let's say something like this

let pages = [{
        downloadUrl: require('../../public/apple-touch-icon.png')
      },
        {
          downloadUrl: require('../../public/images/avid-wallpapers.jpg')
        }];
      if (pages && pages.length !== 0) {
        return (
          <Coverflow width="960" height="500"
                     displayQuantityOfSide={2}
                     navigation={false}
                     enableScroll={true}
                     clickable={true}
                     active={0}
          >
            {pages.map((page, index) => {
              console.log("Page", index);
              <img key={"image-cover-" + index} src={page.downloadUrl}/>
            })}
          </Coverflow>
        )
      }

I always end up with some errors in console.
screen shot 2017-07-03 at 09 43 59

SO you see my two images are created as Page 0 and Page 1 seems to go through, but always end with a props error.

Any idea ?

Issue with Server Side Rendering - react-coverflow

Hi, thanks for the library!

I'm having an issue loading the react-coverflow package into my server side bundle.

When importing react-coverflow, webpack compile the server bundle fine.

However, my node server throws the following exception, prior starting:

ReferenceError: window is not defined

src/dist/server/server.js:157240
!function(e,n){ true?module.exports=n(__webpack_require__(2),__webpack_require__(276)):"function"==typeof define&&define.amd?define(["react","react-dom"],n):"object"==typeof exports?exports["react-converflow"]=n(require("react"),require("react-dom")):e["react-converflow"]=n(e.React,e.ReactDOM)}("undefined"!=typeof self?self:this,function(__WEBPACK_EXTERNAL_MODULE_13__,__WEBPACK_EXTERNAL_MODULE_39__){return function(e){function n(e){delete installedChunks[e]}function t(e){var n=document.getElementsByTagName("head")[0],t=document.createElement("script");t.type="text/javascript",t.charset="utf-8",t.src=d.p+""+e+"."+G+".hot-update.js",n.appendChild(t)}function c(e){return e=e||1e4,new Promise(function(n,t){if("undefined"==typeof XMLHttpRequest)return t(new Error("No browser support"));try{var c=new XMLHttpRequest,l=d.p+""+G+".hot-update.json";c.open("GET",l,!0),c.timeout=e,c.send(null)}catch(e){return t(e)}c.onreadystatechange=f

Which points me to this line of the dist/react-coverflow.js file.

var o=window.webpackHotUpdatereact_converflow;window.webpackHotUpdatereact_converflow

Example Usage In my code base:

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import CoverFlow from 'react-coverflow';

import style from './SerieCarousel.scss';
import Serie from './Serie';

class SerieCarousel extends PureComponent {
  render() {
    const { series } = this.props;

    const settings = {
      width: 960,
      height: 480,
      displayQuantityOfSide: 2,
      navigation: false,
      enableHeading: false,
      clickable: true,
      active: 0,
      enableScroll: false,
    };

    return (
      <CoverFlow {...settings}>
        {series.map((serie, key) => (
          <div className={style.frame}>
            <Serie serie={serie} key={key} />
          </div>
        ))}
      </CoverFlow>
    );
  }
}

export default SerieCarousel;

Is there something that I'm missing to be able to server-side my component with this library?

Get/Set Centered/Active Child

Is there any way to get/set the active/center child number or key?

Setting could be done using a prop which take number/key of the child to be activated/centered. Whereas for getting the active child, a function like onActiveChildChange could be made and param passes the details of the active child.

Replace url with onclick action

There could be use cases where not everyone needs to open a url on cover click. A better approach would be to make it customisable action function, so that we can do anything we want with it.

Css Customization & Support

Hi Folks,

I would say tremendous effort to bring up such a fine and precise work.
For sure a re-usable and easy to implement component.
Would request the team to provide help on the following enhancements:

  1. The parameter/prop list supplied to CoverFlow to hold custom updates to css like background color/fonts/etc.
  2. Have navigation buttons on the sides rather than bottom(other related customization options if possible.)

Thanks a ton,
Shalabh

Crash with hot loading react

Hi,

thanks for Coverflow. I am trying to make it work, but it crashes with the following error messages.

What can I do?

Best...
Matthias


Fetch API cannot load webpack-internal:///./src/Coverflow.js. URL scheme must be "http" or "https" for CORS request.
_callee$ @ index.js:2429
index.js:2429 Fetch API cannot load webpack-internal:///./node_modules/react-hot-loader/dist/react-hot-loader.development.js. URL scheme must be "http" or "https" for CORS request.
_callee$ @ index.js:2429
react-dom.development.js:62 Uncaught Error: Unable to find node on an unmounted component.
    at invariant (react-dom.development.js:55)
    at findCurrentFiberUsingSlowPath (react-dom.development.js:4158)
    at findCurrentHostFiber (react-dom.development.js:4266)
    at findHostInstance (react-dom.development.js:17676)
    at Object.findDOMNode (react-dom.development.js:18145)
    at ProxyComponent.updateDimensions (Coverflow.js?2a0d:127)
    at ProxyComponent.updateDimensions (react-hot-loader.development.js?c2cb:580)
    at ProxyComponent.componentDidMount (Coverflow.js?2a0d:76)
    at ProxyComponent.componentDidMount (react-hot-loader.development.js?c2cb:570)
    at commitLifeCycles (react-dom.development.js:9784)
    at commitAllLifeCycles (react-dom.development.js:11455)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
    at invokeGuardedCallback (react-dom.development.js:187)
    at commitRoot (react-dom.development.js:11594)
    at completeRoot (react-dom.development.js:12502)
    at performWorkOnRoot (react-dom.development.js:12452)
    at performWork (react-dom.development.js:12370)
    at performSyncWork (react-dom.development.js:12347)
    at requestWork (react-dom.development.js:12247)
    at scheduleWorkImpl (react-dom.development.js:12122)
    at scheduleWork (react-dom.development.js:12082)
    at Object.enqueueForceUpdate (react-dom.development.js:6682)
    at ProxyComponent../node_modules/react/cjs/react.development.js.Component.forceUpdate (react.development.js:431)
    at ProxyComponent.Query._this.updateCurrentData (react-apollo.browser.umd.js:358)
    at Object.next (react-apollo.browser.umd.js:329)
    at notifySubscription (Observable.js:126)
    at onNotify (Observable.js:161)
    at SubscriptionObserver.next (Observable.js:215)
    at ObservableQuery.js:396
    at Array.forEach (<anonymous>)
    at Object.next (ObservableQuery.js:396)
    at QueryManager.js:470
    at QueryManager.js:809
    at Array.forEach (<anonymous>)
    at QueryManager.js:808
    at Map.forEach (<anonymous>)
    at QueryManager../node_modules/apollo-client/core/QueryManager.js.QueryManager.broadcastQueries (QueryManager.js:801)
    at Object.next (QueryManager.js:849)
    at notifySubscription (Observable.js:126)
    at onNotify (Observable.js:161)
    at SubscriptionObserver.next (Observable.js:215)
    at dedupLink.js:57
    at Array.forEach (<anonymous>)
    at Object.next (dedupLink.js:57)
    at notifySubscription (Observable.js:126)
    at onNotify (Observable.js:161)
    at SubscriptionObserver.next (Observable.js:215)
    at httpLink.js:91
index.js:2178 The above error occurred in the <Coverflow> component:
    in Coverflow (created by HotExportedCoverflow)
    in AppContainer (created by HotExportedCoverflow)
    in HotExportedCoverflow (created by EvidenceComponent)

Option to start at beginning

When the coverflow initially renders, it starts somewhere in the middle of the images. It would be nice specify an option to start at the beginning of the images.

Sliding only works on the first click.

The first image clicked will slide to the centre; after that clicking on an image has no effect.
Removing this code

// this.refs.stage.style['pointerEvents'] = 'none';

from lime 247 appears to solve the problem.

WebpackError: window is not defined on production netlify

Suggest, how to resolve it?

8:09:54 PM: 2 | /!!
8:09:54 PM: 3 | !
./node_modules/babel-runtime/core-js/object/assign.js !
8:09:54 PM: 4 | *
*/
8:09:54 PM:
8:09:54 PM: WebpackError: window is not defined
8:09:54 PM:
8:09:54 PM: - react-coverflow.js:1 Object.module.exports.results.id
8:09:54 PM: ~/react-coverflow/dist/react-coverflow.js:1:330
8:09:54 PM:
8:09:54 PM: - main.js:1 Object.
8:09:54 PM: ~/react-coverflow/main.js:1:1
8:09:54 PM:
8:09:54 PM: - Titles.jsx:8 Object.
8:09:54 PM: src/blocks/NimasTitles.jsx:8:1
8:09:54 PM:
8:09:54 PM: - index.jsx:29 Object.exports.__esModule
8:09:54 PM: src/pages/index.jsx:29:1
8:09:54 PM:
8:09:54 PM: - sync-requires.js:20 Object.exports.__esModule
8:09:54 PM: .cache/sync-requires.js:20:52

Clicking an item in Coverflow generates error

Uncaught TypeError: Cannot read property 'preventDefault' of undefined
    at ProxyComponent.Coverflow._this._handleFigureClick (Coverflow.js?b672:257)
    at onClick (Coverflow.js?b672:277)

I created PR 41 to fix this.
#41

undefined property going into radium module - related to missing stylesheet?

I keep getting the following error, and I just can't seem to figure out what's causing it.

defineProperty.value
node_modules/react-coverflow/dist/react-coverflow.js:474
  471 | !function(){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen};r=function(){return i}.call(t,n,t,e),!(void 0!==r&&(e.exports=r))}()},/*!******************************************!*\
  472 |   !*** ./~/radium/lib/components/style.js ***!
  473 |   \******************************************/
> 474 | function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=n(/*! ../css-rule-set-to-string */102),a=r(i),s=n(/*! react */92),u=r(s),l=u["default"].createClass({displayName:"Style",propTypes:{radiumConfig:s.PropTypes.object,rules:s.PropTypes.object,scopeSelector:s.PropTypes.string},contextTypes:{_radiumConfig:s.PropTypes.object},getDefaultProps:function(){return{scopeSelector:""}},_buildStyles:function(e){var t=this,n=this.props.radiumConfig&&this.props.radiumConfig.userAgent||this.context&&this.context._radiumConfig&&this.context._radiumConfig.userAgent,r=this.props.scopeSelector,i=Object.keys(e).reduce(function(t,n){return"object"!==o(e[n])&&(t[n]=e[n]),t},{}),s=Object.keys(i).length?(0,a["default"])(r||"",i,n):"";return s+Object.keys(e).reduce(function(i,s){var u=e[s];if("mediaQueries"===s)i+=t._buildMediaQueryString(u);else if("object"===o(e[s])){var l=r?s.split(",").map(function(e){return r+" "+e.trim()}).join(","):s;i+=(0,a["default"])(l,u,n)}return i},"")},_buildMediaQueryString:function(e){var t=this,n="";return Object.keys(e).forEach(function(r){n+="@media "+r+"{"+t._buildStyles(e[r])+"}"}),n},render:function(){if(!this.props.rules)return null;var e=this._buildStyles(this.props.rules);return u["default"].createElement("style",{dangerouslySetInnerHTML:{__html:e}})}});t["default"]=l,e.exports=t["default"]},/*!***********************************************!*\

It seems to be related to a missing stylesheet or something, but according to the README, it seems everything should be included (also made sure css-module was installed too).

The required stylesheet using css-module and include in package(js file), so you don't need include other stylesheet.

For reference, this is my render() (also tried with/without StyleRoot, media, etc):

    render() {
        return (
            <StyleRoot>
                <Coverflow width="960" height="500"
                displayQuantityOfSide={2}
                navigation={true}
                enableHeading={false}
                enableScroll={true}
                clickable={true}
                active={this.state.active}
                media={{
                    '@media (max-width: 900px)': {
                    width: '600px',
                    height: '300px'
                    },
                    '@media (min-width: 900px)': {
                    width: '960px',
                    height: '600px'
                    }
                }}
                >
                <img src='..' alt='title or description' data-action={fn} />
                <img src='..' alt='title or description' data-action="{fn}"/>
                <img src='..' alt='title or description' data-action="{fn}"/>
                </Coverflow>
            </StyleRoot>
        );    
    }

Any assistance or guidance would be much appreciated, thanks!

Universal/Isomorphic app support.

I am building an app with server side rendering. How to make this component support, I am using react-starter-kit which injects css on the server.

This is the error I got:
Error: The style-loader cannot be used in a non-browser environment

Invariant Violation

Decided to give the new version a try. Using the same github code example, when I run the example I get:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).

Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Got error Uncaught TypeError: Cannot read property 'removeEventListener' of undefined

componentWillUnmount() {
    let length = React.Children.count(this.props.children);

    TRANSITIONS.forEach(event => {
      for (let i = 0; i < length; i++) {
        let figureID = `figure_${i}`;
        this.refs[figureID].removeEventListener(event, HandleAnimationState.bind(this));
      }
    });
    window.removeEventListener('resize', this.updateDimensions.bind(this));
    document.removeEventListener('keypress', this._keypress.bind(this));
  }

I have 2 questions:

  1. I got error when move from page that has react-coverflow to other page that has no react-coverflow, react-coverflow can't find this.refs[figureID]
    Is it okay to add preventif code to check whether this.refs[figureID] is exist or not? or anyone has any other way of how to avoid this error?

  2. I have set navigation true, the button appeared but it becomes clickable only after user scroll the coverflow. So user can't use the initial button until they use the scroll event. Does anyone have experienced the same thing?

NB: I imported react-coverflow using dynamic(). (In case there is any relation with how the way I import react-coverflow and what makes this error appear)

Ability to change scaled values

Currently the component scales the main image to 1.2, this is causing blur on the rendered HTML and it looks totally bad for my display.

Ideally we should be able to set the scaling factor of the main image VS side images

Updating the `active` prop to 0 does not update the UI

This can be observed on the "Support set active outside" demo on the documentation page.

If you click "Click to Radom" (sic) enough times, eventually you will experience the carousel NOT changing. You'll also notice that the demo NEVER lands on the first cover in the collection (the first Adele image).

This is because the random number generator has produced the value 0 and the code in function updateDimensions effectively ignores the case where active === 0. Line 88 seems to be the culprit.

Some error about updateDimensions function

When using the coverflow component as content in the panel component, and resize my Chrome Browser , it will show error as follows

Uncaught Error: findDOMNode was called on an unmounted component.
at invariant (react-with-addons.js:20277)
at Object.findDOMNode (react-with-addons.js:17766)
at Coverflow.updateDimensions (Coverflow.js:120)
at Coverflow.eval (makeAssimilatePrototype.js:15)

It looks like there's some things wrong with resize action, but in fact view and function work as well
need some suggestion..

Thanks for your help.

Switching out photos doesn't reset scroll position

I use a button bar to swap out and load a different set of images into the cover flow. For example, if the coverflow is currently scrolled to the 20th image, and then I load in a different set of images, it remains on the 20th image. The new set of images may have less than 20, which puts the component in a weird state.

Essentially, if a new set of images is swapped in, it should reset the scroll position to the center (or optionally) the beginning.

ES6 Updates?

Hi team! First, thanks so much for this product. I'm working with it now and it's making my react super UI pretty.

I installed version 0.2.3 from npm and I'm getting deprecation warnings in my browser concerning the use of React.createclass. The more recent use cases on here seem to show you all are using Javascript classic cases now, have you thought about updating the npm package? I'd be happy to help if I can...

TypeScript definitions

It would be really useful to have TypeScript definitions for this package so that it can be used in TypeScript projects safely.

Disabled prop

I think one important prop that is missing is disabled and it can be done easily by changing only the pointer-events to none when this prop is true

package dependency issue

Hi, I installed the latest version 0.2.3 of coverflow. Unfortunately something goes wrong. I see the dependencies in the source are correct. But installing it gives me this error:

├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├── UNMET PEER DEPENDENCY react@^0.14.0
│ └─┬ [email protected]
│ └─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]

The thing is i use material-ui which requires tap event plugin 2.0.0. Also having this set-up i get the following error starting my site:

[email protected] requires a peer of react@^0.14.0 but none was installed.

Also your package is dependant on react 15.3.1.

regards

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.