Skip to content

Commit e920da1

Browse files
authored
Merge pull request Atyantik#2 from zeel123/master
Implement Redux
2 parents 1705922 + 0cc1db7 commit e920da1

File tree

4 files changed

+98
-14
lines changed

4 files changed

+98
-14
lines changed

package-lock.json

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@
4040
"bugs": {
4141
"url": "https://github.com/Atyantik/example-pawjs-redux/issues"
4242
},
43-
"homepage": "https://github.com/Atyantik/example-pawjs-redux#readme"
43+
"homepage": "https://github.com/Atyantik/example-pawjs-redux#readme",
44+
"dependencies": {
45+
"classnames": "^2.2.6"
46+
}
4447
}

src/app/components/home/home.css

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
}
55
.title {
66
font-size: 38px;
7+
text-align: left;
8+
margin-bottom: 0;
79
}
810
.btn {
911
margin: 18px;
@@ -13,8 +15,57 @@
1315
color: #ffffff;
1416
font-size: 16px;
1517
font-weight: 800;
18+
margin-left: 0;
1619
}
1720
.value {
18-
font-size: 24px;
21+
font-size: 180px;
1922
font-weight: 900;
2023
}
24+
.row{
25+
display: flex;
26+
flex-wrap: wrap;
27+
width: 100%;
28+
justify-content: space-evenly;
29+
align-items: center;
30+
}
31+
.mw500{
32+
max-width: 500px;
33+
margin: 0 auto;
34+
}
35+
.col12{
36+
width: 100%;
37+
float: left;
38+
text-align: left;
39+
}
40+
.col6{
41+
width: 50%;
42+
float: left;
43+
text-align: right;
44+
}
45+
.col6md{
46+
width: 50%;
47+
float: left;
48+
}
49+
.mt{
50+
margin-top: 3rem;
51+
}
52+
.black{
53+
background-color: black;
54+
text-decoration: none;
55+
}
56+
@media (max-width: 575px) {
57+
.col6{
58+
width: 100%;
59+
text-align: center;
60+
}
61+
.value{
62+
font-size: 100px;
63+
}
64+
.col12{
65+
text-align: center;
66+
}
67+
.title{
68+
text-align: center;
69+
}
70+
71+
}

src/app/components/home/home.js

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
22
import _ from 'lodash';
33
import PropTypes from 'prop-types';
44
import { connect } from 'react-redux';
5+
import classNames from 'classnames';
56
import { decrementCounter, incrementCounter } from './actions';
67

78
// import custom CSS
@@ -41,19 +42,43 @@ class Home extends Component {
4142
const { counterValue } = this.props;
4243
return (
4344
<div className={styles.container}>
44-
<h1 className={styles.title}>Redux Counter</h1>
45-
<div>
46-
<button type="button" onClick={e => this.incrementCounter(e)} className={styles.btn}>
47-
Increment Counter
48-
</button>
49-
</div>
50-
<div className={styles.value}>
51-
{counterValue}
45+
<div className={styles.mw500}>
46+
<h1 className={styles.title}>Redux counter</h1>
47+
<div className={styles.row}>
48+
<div className={styles.col6}>
49+
<div className={styles.row}>
50+
<div className={styles.col12}>
51+
<div>
52+
<button type="button" onClick={e => this.incrementCounter(e)} className={styles.btn}>
53+
Increment Counter
54+
</button>
55+
</div>
56+
</div>
57+
<div className={styles.col12}>
58+
<div>
59+
<button type="button" onClick={e => this.incrementCounter(e)} className={styles.btn}>
60+
Increment Counter
61+
</button>
62+
</div>
63+
</div>
64+
</div>
65+
</div>
66+
<div className={styles.col6}>
67+
68+
<div className={styles.value}>
69+
{counterValue}
70+
</div>
71+
</div>
72+
73+
</div>
5274
</div>
53-
<div>
54-
<button type="button" onClick={e => this.decrementCounter(e)} className={styles.btn}>
55-
Decrement Counter
56-
</button>
75+
<div className={styles.mt}>
76+
<a
77+
href="https://github.com/Atyantik/example-pawjs-redux.git"
78+
className={classNames(styles.btn, styles.black)}
79+
>
80+
View source code
81+
</a>
5782
</div>
5883
</div>
5984
);

0 commit comments

Comments
 (0)