Skip to content

Commit cf483d2

Browse files
author
Marek Rozmus
committed
Fix code review issues
1 parent 33b04e8 commit cf483d2

File tree

6 files changed

+70
-8
lines changed

6 files changed

+70
-8
lines changed

examples/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"rules": {
1414
"no-undef": "error",
1515
"react-hooks/rules-of-hooks": "error",
16-
"react-hooks/exhaustive-deps": "warn"
16+
"react-hooks/exhaustive-deps": "error"
1717
}
1818
}

examples/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function App() {
6565
return (
6666
<div className={styles.example}>
6767
<h3>react-swipeable-list example</h3>
68-
<h5>(switch on dev tools to mobile view)</h5>
68+
<h5>(try also mobile view in dev tools for touch events)</h5>
6969
<h3>Simple example</h3>
7070
<span className={styles.actionInfo}>{triggeredSimpleItemAction}</span>
7171
<div className={styles.listContainer}>

examples/src/ComplexListItem.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
border-bottom: 1px solid #c4c4c4;
55
flex: 1;
66
min-width: 0;
7+
user-select: none;
8+
cursor: pointer;
79
}
810

911
.label {

examples/src/app.css

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ h5 {
1717
}
1818

1919
.listContainer {
20-
width: 300px;
21-
padding: 8px;
20+
width: 360px;
2221
}
2322

2423
.listItem {
@@ -27,6 +26,9 @@ h5 {
2726
width: 100%;
2827
display: flex;
2928
align-items: center;
29+
padding: 4px 8px;
30+
user-select: none;
31+
cursor: pointer;
3032
}
3133

3234
.contentLeft {
@@ -52,7 +54,55 @@ h5 {
5254
}
5355

5456
.complexListContainer {
55-
width: 300px;
56-
height: 150px;
57-
padding: 8px;
57+
width: 360px;
58+
height: 180px;
59+
border-top: 1px solid gray;
60+
border-bottom: 1px solid gray;
61+
}
62+
63+
/* The device with borders */
64+
.smartphone {
65+
position: relative;
66+
width: 360px;
67+
height: 640px;
68+
margin: auto;
69+
border: 16px black solid;
70+
border-top-width: 60px;
71+
border-bottom-width: 60px;
72+
border-radius: 36px;
73+
}
74+
75+
/* The horizontal line on the top of the device */
76+
.smartphone::before {
77+
content: '';
78+
display: block;
79+
width: 60px;
80+
height: 5px;
81+
position: absolute;
82+
top: -30px;
83+
left: 50%;
84+
transform: translate(-50%, -50%);
85+
background: #333;
86+
border-radius: 10px;
87+
}
88+
89+
/* The circle on the bottom of the device */
90+
.smartphone::after {
91+
content: '';
92+
display: block;
93+
width: 35px;
94+
height: 35px;
95+
position: absolute;
96+
left: 50%;
97+
bottom: -65px;
98+
transform: translate(-50%, -50%);
99+
background: #333;
100+
border-radius: 50%;
101+
}
102+
103+
/* The screen (or content) of the device */
104+
.smartphone .content {
105+
width: 360px;
106+
height: 640px;
107+
background: white;
58108
}

examples/src/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
name="viewport"
1111
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1"
1212
/>
13+
<meta name="description" content="React swipeable list example" />
14+
<meta name="keywords" content="React,Component,Swipe,List,JavaScript" />
1315
<title>Swipeable list example</title>
1416
</head>
1517
<body>

examples/src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33

4+
import styles from './app.css';
45
import App from './App';
56

6-
ReactDOM.render(<App />, document.getElementById('root'));
7+
ReactDOM.render(
8+
<div className={styles.smartphone}>
9+
<div className={styles.content}>
10+
<App />
11+
</div>
12+
</div>,
13+
document.getElementById('root')
14+
);

0 commit comments

Comments
 (0)