Skip to content

Commit e49668e

Browse files
author
Marek Rozmus
committed
Fix for umd issues and missing styles
1 parent f180e68 commit e49668e

File tree

5 files changed

+49
-107
lines changed

5 files changed

+49
-107
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ yarn add @sandstreamdev/react-swipeable-list
3232
## Usage
3333

3434
```jsx
35+
import { SwipeableList } from '@sandstreamdev/react-swipeable-list';
36+
import '@sandstreamdev/react-swipeable-list/dist/react-swipeable-list.cjs.css';
37+
3538
<SwipeableList>
3639
<SwipeableListItem
3740
swipeLeft={{
@@ -45,7 +48,7 @@ yarn add @sandstreamdev/react-swipeable-list
4548
>
4649
<div>Item name</div>
4750
</SwipeableListItem>
48-
</SwipeableList>
51+
</SwipeableList>;
4952
```
5053

5154
NOTE: `SwipeableListItem` can be used without `SwipeableList` but swipe blocking on scroll needs to be handled.

package-lock.json

Lines changed: 9 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
],
2121
"main": "dist/react-swipeable-list.cjs.js",
2222
"module": "dist/react-swipeable-list.esm.js",
23-
"browser": "dist/react-swipeable-list.umd.js",
2423
"peerDependencies": {
2524
"prop-types": "^15.7.2",
2625
"react": "^16.8.0",
@@ -50,8 +49,6 @@
5049
"react-dom": "^16.8.0",
5150
"rollup": "^1.20.3",
5251
"rollup-plugin-babel": "^4.3.3",
53-
"rollup-plugin-commonjs": "^9.3.4",
54-
"rollup-plugin-node-resolve": "^4.2.4",
5552
"rollup-plugin-postcss": "^2.0.3",
5653
"stylelint": "^11.0.0",
5754
"stylelint-config-standard": "^19.0.0"

rollup.config.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,9 @@
1-
import resolve from 'rollup-plugin-node-resolve';
2-
import commonjs from 'rollup-plugin-commonjs';
31
import babel from 'rollup-plugin-babel';
42
import postcss from 'rollup-plugin-postcss';
53

64
import pkg from './package.json';
75

86
export default [
9-
{
10-
input: 'src/index.js',
11-
output: {
12-
name: pkg.name,
13-
file: pkg.browser,
14-
format: 'umd'
15-
},
16-
plugins: [
17-
resolve(),
18-
babel({
19-
exclude: ['node_modules/**']
20-
}),
21-
commonjs({
22-
namedExports: {
23-
'node_modules/react/index.js': [
24-
'PureComponent',
25-
'Children',
26-
'createElement',
27-
'useEffect',
28-
'useState'
29-
]
30-
}
31-
}),
32-
postcss({
33-
extract: true,
34-
modules: true
35-
})
36-
]
37-
},
387
{
398
input: 'src/index.js',
409
external: ['react', 'prop-types'],

src/SwipeableListItem.css

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,43 @@
2121
}
2222

2323
.contentRight {
24-
composes: contentLeft;
24+
position: absolute;
25+
width: 100%;
26+
height: 100%;
27+
z-index: -1;
28+
display: flex;
29+
flex-direction: row;
30+
align-items: center;
31+
box-sizing: border-box;
32+
opacity: 0;
2533
justify-content: flex-end;
2634
}
2735

28-
.return {
29-
transition: opacity 0.5s ease-out;
30-
}
31-
3236
.contentLeftReturn {
33-
composes: contentLeft return;
37+
position: absolute;
38+
width: 100%;
39+
height: 100%;
40+
z-index: -1;
41+
display: flex;
42+
flex-direction: row;
43+
align-items: center;
44+
box-sizing: border-box;
45+
opacity: 0;
46+
transition: opacity 0.5s ease-out;
3447
}
3548

3649
.contentRightReturn {
37-
composes: contentRight return;
50+
position: absolute;
51+
width: 100%;
52+
height: 100%;
53+
z-index: -1;
54+
display: flex;
55+
flex-direction: row;
56+
align-items: center;
57+
box-sizing: border-box;
58+
opacity: 0;
59+
justify-content: flex-end;
60+
transition: opacity 0.5s ease-out;
3861
}
3962

4063
.content {
@@ -47,6 +70,11 @@
4770
}
4871

4972
.contentReturn {
50-
composes: content;
73+
width: 100%;
74+
align-items: center;
75+
box-sizing: border-box;
76+
background-color: #fff;
77+
height: 100%;
78+
display: flex;
5179
transition: transform 0.5s ease-out;
5280
}

0 commit comments

Comments
 (0)