Skip to content

Commit

Permalink
Merge pull request #16 from vadymshymko/develop
Browse files Browse the repository at this point in the history
Update packages
  • Loading branch information
vadymshymko authored Apr 24, 2020
2 parents 84bcd51 + bbe0ed1 commit 79b926c
Show file tree
Hide file tree
Showing 4 changed files with 553 additions and 236 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-simply-carousel",
"version": "2.1.8",
"version": "2.1.9",
"description": "Simple react.js carousel component",
"main": "dist/index.js",
"files": [
Expand All @@ -11,8 +11,8 @@
"sideEffects": false,
"scripts": {
"build": "webpack",
"lint": "eslint . --ignore-path .eslintignore --ext .js,.jsx",
"lint:fix": "eslint . --ignore-path .eslintignore --ext .js,.jsx --fix",
"lint": "eslint . --ignore-path .gitignore --ext .js,.jsx",
"lint:fix": "eslint . --ignore-path .gitignore --ext .js,.jsx --fix",
"prepublish": "yarn run lint && yarn run build"
},
"husky": {
Expand Down Expand Up @@ -72,22 +72,23 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-remove-console": "^6.9.4",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^3.5.2",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.18.0",
"css-loader": "^3.5.3",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-loader": "^4.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.14.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"husky": "^4.2.5",
"jest": "^25.4.0",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"lint-staged": "^10.1.7",
"path": "^0.12.7",
"postcss-loader": "^3.0.0",
"style-loader": "^1.1.4",
"style-loader": "^1.2.0",
"webpack": "^4.43.0",
"webpack-bundle-analyzer": "^3.7.0",
"webpack-cli": "^3.3.11"
Expand Down
103 changes: 54 additions & 49 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,6 @@ import PropTypes from 'prop-types';
import styles from './styles.less';

class ReactSimplyCarousel extends Component {
static propTypes = {
activeSlideIndex: PropTypes.number.isRequired,
activeSlideProps: PropTypes.objectOf(PropTypes.any),
autoplay: PropTypes.bool,
autoplayDirection: PropTypes.oneOf(['forward', 'backward']),
backwardBtnProps: PropTypes.objectOf(PropTypes.any),
centerMode: PropTypes.bool,
children: PropTypes.node,
containerProps: PropTypes.objectOf(PropTypes.any),
delay: PropTypes.number,
disableNavIfAllVisible: PropTypes.bool,
easing: PropTypes.string,
forwardBtnProps: PropTypes.objectOf(PropTypes.any),
hideNavIfAllVisible: PropTypes.bool,
innerProps: PropTypes.objectOf(PropTypes.any),
itemsListProps: PropTypes.objectOf(PropTypes.any),
itemsToScroll: PropTypes.number,
itemsToShow: PropTypes.number,
onAfterChange: PropTypes.func,
onRequestChange: PropTypes.func.isRequired,
responsiveProps: PropTypes.arrayOf(PropTypes.object),
speed: PropTypes.number,
updateOnItemClick: PropTypes.bool,
};

static defaultProps = {
activeSlideProps: {},
autoplay: false,
autoplayDirection: 'forward',
backwardBtnProps: {},
centerMode: false,
children: null,
containerProps: {},
delay: 0,
disableNavIfAllVisible: true,
easing: 'linear',
forwardBtnProps: {},
hideNavIfAllVisible: true,
innerProps: {},
itemsListProps: {},
itemsToScroll: 1,
itemsToShow: 0,
onAfterChange: null,
responsiveProps: [],
speed: 0,
updateOnItemClick: false,
};

constructor(props) {
super(props);

Expand Down Expand Up @@ -478,7 +430,7 @@ class ReactSimplyCarousel extends Component {
...(isActive ? activeSlideProps : {}),
};

this.renderedSlidesCount = this.renderedSlidesCount + 1;
this.renderedSlidesCount += 1;

return {
props,
Expand Down Expand Up @@ -581,11 +533,13 @@ class ReactSimplyCarousel extends Component {
<div
className={`${styles.ReactJSSimpleCarousel} ${containerClassName}`}
onClickCapture={this.handleContainerClickCapture}
// eslint-disable-next-line react/jsx-props-no-spreading
{...containerProps}
ref={this.containerRef}
>
{showBackwardBtn && !hideNav && (
<button
// eslint-disable-next-line react/jsx-props-no-spreading
{...backwardBtnProps}
type="button"
onClick={this.handleBackwardBtnClick}
Expand All @@ -600,6 +554,7 @@ class ReactSimplyCarousel extends Component {
width: innerWidth ? `${innerWidth}px` : innerWidthStyle,
...innerStyle,
}}
// eslint-disable-next-line react/jsx-props-no-spreading
{...innerProps}
ref={this.innerRef}
>
Expand All @@ -616,6 +571,7 @@ class ReactSimplyCarousel extends Component {
onTransitionEnd={speed || delay ? this.updatePositionIndex : null}
tabIndex="-1"
role="presentation"
// eslint-disable-next-line react/jsx-props-no-spreading
{...itemsListProps}
ref={this.itemsListRef}
>
Expand All @@ -628,6 +584,7 @@ class ReactSimplyCarousel extends Component {

{showForwardBtn && !hideNav && (
<button
// eslint-disable-next-line react/jsx-props-no-spreading
{...forwardBtnProps}
type="button"
onClick={this.handleForwardBtnClick}
Expand All @@ -640,4 +597,52 @@ class ReactSimplyCarousel extends Component {
}
}

ReactSimplyCarousel.propTypes = {
activeSlideIndex: PropTypes.number.isRequired,
activeSlideProps: PropTypes.objectOf(PropTypes.any),
autoplay: PropTypes.bool,
autoplayDirection: PropTypes.oneOf(['forward', 'backward']),
backwardBtnProps: PropTypes.objectOf(PropTypes.any),
centerMode: PropTypes.bool,
children: PropTypes.node,
containerProps: PropTypes.objectOf(PropTypes.any),
delay: PropTypes.number,
disableNavIfAllVisible: PropTypes.bool,
easing: PropTypes.string,
forwardBtnProps: PropTypes.objectOf(PropTypes.any),
hideNavIfAllVisible: PropTypes.bool,
innerProps: PropTypes.objectOf(PropTypes.any),
itemsListProps: PropTypes.objectOf(PropTypes.any),
itemsToScroll: PropTypes.number,
itemsToShow: PropTypes.number,
onAfterChange: PropTypes.func,
onRequestChange: PropTypes.func.isRequired,
responsiveProps: PropTypes.arrayOf(PropTypes.object),
speed: PropTypes.number,
updateOnItemClick: PropTypes.bool,
};

ReactSimplyCarousel.defaultProps = {
activeSlideProps: {},
autoplay: false,
autoplayDirection: 'forward',
backwardBtnProps: {},
centerMode: false,
children: null,
containerProps: {},
delay: 0,
disableNavIfAllVisible: true,
easing: 'linear',
forwardBtnProps: {},
hideNavIfAllVisible: true,
innerProps: {},
itemsListProps: {},
itemsToScroll: 1,
itemsToShow: 0,
onAfterChange: null,
responsiveProps: [],
speed: 0,
updateOnItemClick: false,
};

export default ReactSimplyCarousel;
Loading

0 comments on commit 79b926c

Please sign in to comment.