Skip to content

Commit

Permalink
Merge 0247ad8 into 1f251ff
Browse files Browse the repository at this point in the history
  • Loading branch information
paseo committed Oct 16, 2017
2 parents 1f251ff + 0247ad8 commit ea60c5d
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 88 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"plugins": [
"react"
],
"parser": "babel-eslint",
"env": {
"browser": true
},
Expand Down
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ language: node_js

sudo: false

addons:
apt:
packages:
- xvfb

notification:
email:
- wsj7552715@hotmail.com

node_js:
- 4.0.0
- 6.9.0

before_install:
- |
Expand All @@ -17,6 +22,11 @@ before_install:
exit
fi
phantomjs --version
install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- npm install


script:
- |
Expand All @@ -25,7 +35,6 @@ script:
else
npm run $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=test
Expand All @@ -34,4 +43,4 @@ env:

matrix:
allow_failures:
- env: "TEST_TYPE=saucelabs"
- env: "TEST_TYPE=saucelabs"
7 changes: 3 additions & 4 deletions demo/CarouselDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
* All rights reserved.
*/

const React = require('react');

const Carousel = require('../src');
import React from 'react';
import Carousel from '../src';

class Demo extends React.Component {

Expand Down Expand Up @@ -48,4 +47,4 @@ class Demo extends React.Component {
}
}

module.exports = Demo;
export default Demo;
7 changes: 5 additions & 2 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
* All rights reserved.
*/

var Demo = require('./CarouselDemo');
ReactDOM.render(<Demo/>, document.getElementById('UXCoreDemo'));
import React from 'react';
import ReactDOM from 'react-dom';
import Demo from './CarouselDemo';

ReactDOM.render(<Demo />, document.getElementById('UXCoreDemo'));
104 changes: 54 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
{
"name": "uxcore-carousel",
"version": "0.3.6",
"description": "uxcore-carousel component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-carousel.git",
"author": "eternaslky",
"main": "build/index.js",
"scripts": {
"start": "uxcore-tools run start",
"server": "uxcore-tools run server",
"lint": "uxcore-tools run lint",
"build": "uxcore-tools run build",
"test": "uxcore-tools run test",
"coverage": "uxcore-tools run coverage",
"pub": "uxcore-tools run pub",
"dep": "uxcore-tools run dep",
"tnpm-dep": "uxcore-tools run tnpm-dep",
"chrome": "uxcore-tools run chrome",
"browsers": "uxcore-tools run browsers",
"saucelabs": "uxcore-tools run saucelabs",
"update": "uxcore-tools run update"
},
"bugs": {
"url": "http://github.com/uxcore/uxcore-carousel/issues"
},
"keywords": [
"react",
"react-component",
"uxcore-carousel",
"Carousel",
""
],
"devDependencies": {
"console-polyfill": "^0.2.2",
"es5-shim": "^4.5.8",
"expect.js": "~0.3.1",
"kuma-base": "1.x",
"react": "0.14.x",
"react-addons-test-utils": "0.14.x",
"react-dom": "0.14.x",
"uxcore-kuma": "2.x",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"object-assign": "^4.0.0",
"react-slick": "0.14.8"
},
"contributors": [],
"license": "MIT"
}
"name": "uxcore-carousel",
"version": "0.3.6",
"description": "uxcore-carousel component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-carousel.git",
"author": "eternaslky",
"main": "build/index.js",
"scripts": {
"start": "uxcore-tools run start",
"server": "uxcore-tools run server",
"lint": "uxcore-tools run lint",
"build": "uxcore-tools run build",
"test": "uxcore-tools run test",
"coverage": "uxcore-tools run coverage",
"pub": "uxcore-tools run pub",
"dep": "uxcore-tools run dep",
"tnpm-dep": "uxcore-tools run tnpm-dep",
"chrome": "uxcore-tools run chrome",
"browsers": "uxcore-tools run browsers",
"saucelabs": "uxcore-tools run saucelabs",
"update": "uxcore-tools run update",
"tnpm-update": "uxcore-tools run tnpm-update"
},
"bugs": {
"url": "http://github.com/uxcore/uxcore-carousel/issues"
},
"keywords": [
"react",
"react-component",
"uxcore-carousel",
"Carousel",
""
],
"devDependencies": {
"console-polyfill": "^0.2.2",
"enzyme": "^3.0.0",
"enzyme-adapter-react-15": "^1.0.0",
"es5-shim": "^4.5.8",
"expect.js": "~0.3.1",
"kuma-base": "1.x",
"react": "15.x",
"react-addons-test-utils": "^15.6.2",
"react-dom": "15.x",
"react-test-renderer": "15.x",
"uxcore-kuma": "*",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"prop-types": "15.x",
"react-slick": "0.14.8"
},
"contributors": [],
"license": "MIT"
}
52 changes: 24 additions & 28 deletions src/Carousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82

import classnames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import Slick from 'react-slick';

if (typeof window !== 'undefined') {
const matchMediaPolyfill = function matchMediaPolyfill() {
return {
Expand All @@ -22,12 +27,24 @@ if (typeof window !== 'undefined') {
window.matchMedia = window.matchMedia || matchMediaPolyfill;
}

const Slick = require('react-slick');
const classnames = require('classnames');
const React = require('react');


class Carousel extends React.Component {
static displayName = 'Carousel';
static propTypes = {
centerDots: PropTypes.bool,
children: PropTypes.node,
};
static defaultProps = {
prefixCls: 'kuma-carousel',
largeArrowsAndDots: false,
dots: true,
cssEase: 'ease-out',
infinite: true,
speed: 500,
slidesToShow: 1,
centerDots: true,
slidesToScroll: 1,
arrows: 'hover',
};

processChildren() {
const me = this;
Expand All @@ -40,8 +57,8 @@ class Carousel extends React.Component {

render() {
const me = this;

const { className, prefixCls, centerDots, largeArrowsAndDots, ...props } = me.props;

props.arrows = !!props.arrows;

return (
Expand All @@ -62,26 +79,5 @@ class Carousel extends React.Component {
}
}

Carousel.defaultProps = {
prefixCls: 'kuma-carousel',
largeArrowsAndDots: false,
dots: true,
cssEase: 'ease-out',
infinite: true,
speed: 500,
slidesToShow: 1,
centerDots: true,
slidesToScroll: 1,
arrows: 'hover'
};


// http://facebook.github.io/react/docs/reusable-components.html
Carousel.propTypes = {
centerDots: React.PropTypes.bool,
children: React.PropTypes.node,
};

Carousel.displayName = 'Carousel';
export default Carousel;

module.exports = Carousel;
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
* All rights reserved.
*/

module.exports = require('./Carousel');
import Carousel from './Carousel';

export default Carousel;

0 comments on commit ea60c5d

Please sign in to comment.