Skip to content

Commit 403ab03

Browse files
committed
BuyNowButton
1 parent 1f4ffb7 commit 403ab03

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

components/buybutton.js

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
32
/**
43
*
54
*
65
* @export
7-
* @class buybutton
8-
* @augments {React.PureComponent<buybuttonProps>}
6+
* @class BuyNow
7+
* @augments {React.PureComponent<BuyNowProps>}
98
*/
10-
export default class buybutton extends React.PureComponent {
9+
export default class BuyNow extends React.PureComponent {
1110
/**
12-
* @typedef {object} buybuttonProps
13-
* @property {array} links
14-
*
15-
* @static
16-
* @memberof buybutton
11+
* @typedef {object} BuyNowProps
12+
* @property {function} onClick
13+
*
14+
* @static
15+
* @memberof BuyNow
1716
*/
18-
static propTypes = {
19-
links: PropTypes.arrayOf(
20-
PropTypes.shape({
21-
url: PropTypes.string,
22-
title: PropTypes.string,
23-
})
24-
).isRequired,
25-
};
17+
2618

2719
render() {
2820
return (
2921
<React.Fragment>
30-
<button>Buy Now</button>
22+
<style jsx>{`
23+
button {
24+
background-color: #e33812;
25+
color: white;
26+
padding: 15px 32px;
27+
text-align: center;
28+
display: inline-block;
29+
font-size: 16px;
30+
border-radius: 12px;
31+
32+
}
33+
`}</style>
34+
35+
<button onClick={this.props.onClick}>
36+
{this.props.children}
37+
</button>
3138
</React.Fragment>
3239
);
3340
}

pages/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ export default class IndexPage extends React.PureComponent {
5151
<Item id={id} name={name} />
5252
))}
5353
</ul>
54+
<<<<<<< HEAD
55+
</main>
56+
57+
=======
5458
<h2>Buy Now Button</h2>
5559
<buybutton/>
5660
</main>
5761

62+
>>>>>>> 1f4ffb7... buy now button
5863
</React.Fragment>
5964
);
6065
}
61-
6266
/**
6367
* This is for demo purposes.
6468
* Once the component has mounted, we fetch items from our API and sets them to state.

0 commit comments

Comments
 (0)