Skip to content

Commit fa1fa00

Browse files
committed
Add different style file
1 parent 5d6041f commit fa1fa00

File tree

11 files changed

+122
-58
lines changed

11 files changed

+122
-58
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"@types/redux-logger": "^3.0.7",
2222
"redux-logger": "^3.0.6",
2323
"typescript": "^3.7.3",
24-
"webpack-genius": "^4.7.6"
24+
"webpack-genius": "^4.9.0"
2525
}
2626
}

src/components/App.styl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.wrapper
2+
flex-direction: row
3+
display: flex

src/components/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import React, { FunctionComponent } from 'react';
22
import Normal from './Normal';
33
import Request from './Request';
44
import Summary from './Summary';
5+
import styles from './App.styl';
56

67
const App: FunctionComponent = () => {
78
return (
8-
<div style={{ flexDirection: 'row', display: 'flex' }}>
9+
<div className={styles.wrapper}>
910
<Normal />
1011
<Request />
1112
<Summary />

src/components/Normal.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.wrapper {
2+
width: 300px;
3+
height: 300px;
4+
border-width: 1px;
5+
border-color: #ddd;
6+
border-style: solid;
7+
display: flex;
8+
flex-direction: column;
9+
align-items: center;
10+
justify-content: center;
11+
margin: 20px;
12+
padding: 15px;
13+
}

src/components/Normal.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
import React, { CSSProperties, FunctionComponent, useCallback } from 'react';
1+
import React, { FunctionComponent, useCallback } from 'react';
22
import { counterModel } from '../models/CounterModel';
3-
4-
const styles: CSSProperties = {
5-
width: 300,
6-
height: 300,
7-
borderWidth: 1,
8-
borderColor: '#ddd',
9-
borderStyle: 'solid',
10-
display: 'flex',
11-
flexDirection: 'column',
12-
alignItems: 'center',
13-
justifyContent: 'center',
14-
margin: 20,
15-
padding: 15,
16-
};
3+
import styles from './Normal.scss';
174

185
const Normal: FunctionComponent = () => {
196
const count = counterModel.useData((data) => data.amount);
@@ -27,7 +14,7 @@ const Normal: FunctionComponent = () => {
2714
}, []);
2815

2916
return (
30-
<div style={styles}>
17+
<div className={styles.wrapper}>
3118
<h3>Normal Effect:</h3>
3219
<p>You clicked <span style={{ fontSize: 18, color: '#f00' }}>{count}</span> times.</p>
3320
<div>

src/components/Request.less

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.wrapper {
2+
width: 600px;
3+
height: 300px;
4+
padding: 15px;
5+
border-width: 1px;
6+
border-color: #ddd;
7+
border-style: solid;
8+
display: flex;
9+
flex-direction: column;
10+
align-items: flex-start;
11+
justify-content: center;
12+
margin: 20px;
13+
}

src/components/Request.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
import React, { CSSProperties, FunctionComponent, useCallback } from 'react';
1+
import React, { FunctionComponent, useCallback } from 'react';
22
import { npmInfoModel } from '../models/NpmInfoModel';
3-
4-
const styles: CSSProperties = {
5-
width: 600,
6-
height: 300,
7-
padding: 15,
8-
borderWidth: 1,
9-
borderColor: '#ddd',
10-
borderStyle: 'solid',
11-
display: 'flex',
12-
flexDirection: 'column',
13-
alignItems: 'flex-start',
14-
justifyContent: 'center',
15-
margin: 20,
16-
};
3+
import styles from './Request.less';
174

185
const Request: FunctionComponent = () => {
196
const npmInfo = npmInfoModel.useData();
@@ -39,7 +26,7 @@ const Request: FunctionComponent = () => {
3926
}, []);
4027

4128
return (
42-
<div style={styles}>
29+
<div className={styles.wrapper}>
4330
<h3 style={{ textAlign: 'center', width: '100%' }}>Fetch Effect:</h3>
4431
<p>Package: {npmInfo._id || '--'}</p>
4532
<p>License: {npmInfo.license || '--'}</p>

src/components/Summary.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.wrapper {
2+
width: 300px;
3+
height: 300px;
4+
padding: 15px;
5+
border-width: 1px;
6+
border-color: #ddd;
7+
border-style: solid;
8+
display: flex;
9+
flex-direction: column;
10+
align-items: flex-start;
11+
justify-content: center;
12+
margin: 20px;
13+
}

src/components/Summary.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1-
import React, { CSSProperties, FunctionComponent } from 'react';
1+
import React, { FunctionComponent } from 'react';
22
import { summaryModel } from '../models/SummaryModel';
3-
4-
const styles: CSSProperties = {
5-
width: 300,
6-
height: 300,
7-
padding: 15,
8-
borderWidth: 1,
9-
borderColor: '#ddd',
10-
borderStyle: 'solid',
11-
display: 'flex',
12-
flexDirection: 'column',
13-
alignItems: 'flex-start',
14-
justifyContent: 'center',
15-
margin: 20,
16-
};
3+
import styles from './Summary.css';
174

185
const Summary: FunctionComponent = () => {
196
const { times, lastTime } = summaryModel.useData();
207

218
return (
22-
<div style={styles}>
9+
<div className={styles.wrapper}>
2310
<h3>Summary:</h3>
2411
<p>You have clicked buttons <span style={{ fontSize: 20, color: '#f00' }}>{times}</span> times.</p>
2512
<p>Last click time: </p>

webpack.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import webpackGenius from 'webpack-genius';
2+
3+
export default webpackGenius(3000);

0 commit comments

Comments
 (0)