Skip to content

Commit a0a6918

Browse files
author
Marek Rozmus
committed
Fix code review issues
1 parent 341758f commit a0a6918

File tree

3 files changed

+41
-62
lines changed

3 files changed

+41
-62
lines changed

examples/images/icons.js

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,32 @@
11
import React from 'react';
22

3-
export const DeleteIcon = () => {
4-
return (
5-
<svg
6-
xmlns="http://www.w3.org/2000/svg"
7-
width="100%"
8-
height="100%"
9-
viewBox="0 0 24 24"
10-
>
11-
<path fill="none" d="M0 0h24v24H0V0z" />
12-
<path d="M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z" />
13-
</svg>
14-
);
15-
};
3+
const Svg = props => (
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="100%"
7+
height="100%"
8+
viewBox="0 0 24 24"
9+
{...props}
10+
/>
11+
);
1612

17-
export const MailIcon = () => {
18-
return (
19-
<svg
20-
xmlns="http://www.w3.org/2000/svg"
21-
width="100%"
22-
height="100%"
23-
viewBox="0 0 24 24"
24-
>
25-
<path fill="none" d="M0 0h24v24H0V0z" />
26-
<path d="M22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6zm-2 0l-8 4.99L4 6h16zm0 12H4V8l8 5 8-5v10z" />
27-
</svg>
28-
);
29-
};
13+
export const DeleteIcon = () => (
14+
<Svg>
15+
<path fill="none" d="M0 0h24v24H0V0z" />
16+
<path d="M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z" />
17+
</Svg>
18+
);
3019

31-
export const ReplyIcon = () => {
32-
return (
33-
<svg
34-
xmlns="http://www.w3.org/2000/svg"
35-
width="100%"
36-
height="100%"
37-
viewBox="0 0 24 24"
38-
>
39-
<path fill="none" d="M0 0h24v24H0V0z" />
40-
<path d="M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z" />
41-
</svg>
42-
);
43-
};
20+
export const MailIcon = () => (
21+
<Svg>
22+
<path fill="none" d="M0 0h24v24H0V0z" />
23+
<path d="M22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6zm-2 0l-8 4.99L4 6h16zm0 12H4V8l8 5 8-5v10z" />
24+
</Svg>
25+
);
26+
27+
export const ReplyIcon = () => (
28+
<Svg>
29+
<path fill="none" d="M0 0h24v24H0V0z" />
30+
<path d="M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z" />
31+
</Svg>
32+
);

examples/webpack.config.dev.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var HtmlWebpackPlugin = require('html-webpack-plugin');
2-
var path = require('path');
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
const path = require('path');
33

44
const babelLoaderOptions = {
55
presets: ['@babel/env', '@babel/react'],
@@ -55,8 +55,10 @@ module.exports = {
5555
'src',
5656
'app.module.css'
5757
),
58+
5859
// to import module sources
5960
'@sandstreamdev/react-swipeable-list': path.join(__dirname, '..', 'src'),
61+
6062
// to make the module use same react as example
6163
// (otherwise even if same version is in module sources used
6264
// we get error about duplicated react and cannot use hooks)

examples/webpack.config.js

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
var HtmlWebpackPlugin = require('html-webpack-plugin');
2-
var CssLoaderUtils = require('css-loader/dist/utils');
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
32

43
const babelLoaderOptions = {
54
presets: ['@babel/env', '@babel/react'],
@@ -28,33 +27,22 @@ module.exports = {
2827
}
2928
},
3029
{
31-
test: /\.css$/i,
30+
test: /\.css$/,
31+
exclude: /node_modules/,
3232
use: [
3333
{ loader: 'style-loader' },
3434
{
3535
loader: 'css-loader',
3636
options: {
37-
modules: {
38-
getLocalIdent: (
39-
loaderContext,
40-
localIdentName,
41-
localName,
42-
options
43-
) => {
44-
if (loaderContext.resourcePath.includes('node_modules')) {
45-
return localName;
46-
}
47-
return CssLoaderUtils.getLocalIdent(
48-
loaderContext,
49-
localIdentName,
50-
localName,
51-
options
52-
);
53-
}
54-
}
37+
modules: true
5538
}
5639
}
5740
]
41+
},
42+
{
43+
test: /\.css$/,
44+
include: /node_modules/,
45+
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }]
5846
}
5947
]
6048
},

0 commit comments

Comments
 (0)