File tree Expand file tree Collapse file tree 2 files changed +25
-22
lines changed Expand file tree Collapse file tree 2 files changed +25
-22
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import PropTypes from 'prop-types' ;
3
2
/**
4
3
*
5
4
*
6
5
* @export
7
- * @class buybutton
8
- * @augments {React.PureComponent<buybuttonProps > }
6
+ * @class BuyNow
7
+ * @augments {React.PureComponent<BuyNowProps > }
9
8
*/
10
- export default class buybutton extends React . PureComponent {
9
+ export default class BuyNow extends React . PureComponent {
11
10
/**
12
- * @typedef {object } buybuttonProps
13
- * @property {array } links
14
- *
15
- * @static
16
- * @memberof buybutton
11
+ * @typedef {object } BuyNowProps
12
+ *
13
+ * @static
14
+ * @memberof BuyNow
17
15
*/
18
- static propTypes = {
19
- links : PropTypes . arrayOf (
20
- PropTypes . shape ( {
21
- url : PropTypes . string ,
22
- title : PropTypes . string ,
23
- } )
24
- ) . isRequired ,
25
- } ;
16
+ clicked ( ) {
17
+ console . log ( 'the button is clicked' ) ;
18
+ }
19
+
26
20
27
21
render ( ) {
28
22
return (
29
23
< React . Fragment >
30
- < button > Buy Now</ button >
24
+ < style jsx > { `
25
+ button {
26
+ background-color: #e33812;
27
+ color: white;
28
+ padding: 15px 32px;
29
+ text-align: center;
30
+ display: inline-block;
31
+ font-size: 16px;
32
+ border-radius: 12px;
33
+
34
+ }
35
+ ` } </ style >
36
+ < button onClick = { this . clicked } > Buy Now</ button >
31
37
</ React . Fragment >
32
38
) ;
33
39
}
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import React from 'react';
2
2
import Item from '../components/Item' ;
3
3
import NavBar from '../components/NavBar' ;
4
4
import links from '../constants/links' ;
5
- import buybutton from '../components/buybutton' ;
6
5
7
6
/**
8
7
* Home page
@@ -51,9 +50,7 @@ export default class IndexPage extends React.PureComponent {
51
50
< Item id = { id } name = { name } />
52
51
) ) }
53
52
</ ul >
54
- < h2 > Buy Now Button</ h2 >
55
- < buybutton />
56
- </ main >
53
+ </ main >
57
54
58
55
</ React . Fragment >
59
56
) ;
You can’t perform that action at this time.
0 commit comments