Skip to content

Commit

Permalink
Merge branch 'master' into chore/accordion-item-body-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentaudebert committed Jun 11, 2018
2 parents e89b0b9 + 6cab086 commit 24c3806
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 43 deletions.
17 changes: 17 additions & 0 deletions .babelrc
@@ -0,0 +1,17 @@
{
"presets": [
[
"env",
{
"modules": false
}
],
"react",
"stage-2"
],
"env": {
"test": {
"presets": ["env", "react", "stage-2"]
}
}
}
6 changes: 6 additions & 0 deletions .browserslistrc
@@ -0,0 +1,6 @@
ie 11
last 2 chrome versions
last 2 firefox versions
last 2 edge versions
last 2 safari versions
last 2 ios versions
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@
### Fixed

* Fixes issue with spacebar scrolling the page (see PR#99)
* Fixes IE compatibility by replacing uses of Array.prototype.find.

## [[v2.4.2]](https://github.com/springload/react-accessible-accordion/releases/tag/v2.4.2)

Expand Down
62 changes: 62 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 9 additions & 35 deletions package.json
Expand Up @@ -13,12 +13,14 @@
"lint": "eslint .",
"build:css": "cp src/css/*.css dist",
"build:clean": "rm -rf dist/*",
"build:rollup": "NODE_ENV=production rollup -c",
"build:rollup": "rollup -c",
"build:flow": "flow-copy-source src dist/es -i \"**/*.spec.js\"",
"build": "npm run build:clean && npm run build:css && npm run build:flow && npm run build:rollup",
"build":
"npm run build:clean && npm run build:css && npm run build:flow && npm run build:rollup",
"start": "npm run js:watch",
"start-demo": "webpack-dev-server --mode=development",
"pages": "rm -rf pages && webpack --mode=production --progress && cp demo/*.css pages && cp demo/*.ico pages",
"pages":
"rm -rf pages && webpack --mode=production --progress && cp demo/*.css pages && cp demo/*.ico pages",
"deploy": "npm run pages && ./bin/deploy.sh",
"prettier": "prettier **/*.js --write",
"prepublishOnly": "npm run build"
Expand All @@ -27,36 +29,10 @@
"type": "git",
"url": "git+https://github.com/springload/react-accessible-accordion.git"
},
"babel": {
"presets": [
[
"es2015",
{
"modules": false
}
],
"react",
"stage-2"
],
"env": {
"test": {
"presets": [
"es2015",
"react",
"stage-2"
]
}
}
},
"jest": {
"setupFiles": [
"./src/setupTests.js"
],
"setupFiles": ["./src/setupTests.js"],
"setupTestFrameworkScriptFile": "./src/setupTestFramework.js",
"testPathIgnorePatterns": [
"/node_modules/",
"/dist/"
]
"testPathIgnorePatterns": ["/node_modules/", "/dist/"]
},
"keywords": [
"react",
Expand All @@ -66,9 +42,7 @@
"accessible",
"accessibility"
],
"authors": [
"Vincent Audebert <vincent@springload.co.nz>"
],
"authors": ["Vincent Audebert <vincent@springload.co.nz>"],
"contributors": [
{
"name": "Mitch Ryan",
Expand All @@ -92,7 +66,7 @@
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"coveralls": "^3.0.0",
Expand Down
7 changes: 3 additions & 4 deletions rollup.config.js
Expand Up @@ -15,6 +15,9 @@ export default [
],
name: 'reactAccessibleAccordion',
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
resolve({
jsnext: true,
main: true,
Expand All @@ -23,10 +26,6 @@ export default [
eslint(),
babel(),
commonjs(),
replace({
exclude: 'node_modules/**',
ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
}),
],
},
];
4 changes: 2 additions & 2 deletions src/AccordionItem/accordion-item.js
Expand Up @@ -48,9 +48,9 @@ class AccordionItem extends Component<AccordionItemProps, *> {
...rest
} = this.props;

const currentItem = accordionStore.state.items.find(
const currentItem = accordionStore.state.items.filter(
item => item.uuid === uuid,
);
)[0];

if (!currentItem) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/AccordionItemBody/accordion-item-body.js
Expand Up @@ -21,7 +21,7 @@ const AccordionItemBody = (props: AccordionItemBodyProps) => {
accordion,
...rest
} = props;

return (
<div
id={`accordion__body-${uuid}`}
Expand Down
2 changes: 1 addition & 1 deletion src/AccordionItemTitle/accordion-item-title-wrapper.js
Expand Up @@ -22,7 +22,7 @@ const AccordionItemTitleWrapper = (props: AccordionItemTitleWrapperProps) => (
{(accordionStore, itemStore) => {
const { uuid } = itemStore.state;
const { items, accordion } = accordionStore.state;
const item = items.find(stateItem => stateItem.uuid === uuid);
const item = items.filter(stateItem => stateItem.uuid === uuid)[0];

return (
<AccordionItemTitle
Expand Down

0 comments on commit 24c3806

Please sign in to comment.