Skip to content

Commit f346f4c

Browse files
committed
updated buy now button
1 parent f6cad62 commit f346f4c

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

components/buybutton.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,30 @@ export default class BuyNow extends React.PureComponent {
1313
* @static
1414
* @memberof BuyNow
1515
*/
16-
clicked () {
17-
console.log('the button is clicked');
18-
}
19-
16+
17+
clicked (){
18+
console.log('the button is clicked'); //eslint-disable-line no-console
19+
}
2020

2121
render() {
2222
return (
2323
<React.Fragment>
2424
<style jsx>{`
2525
button {
2626
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;
27+
color: white;
28+
padding: 15px 32px;
29+
text-align: center;
30+
display: inline-block;
31+
font-size: 16px;
32+
border-radius: 12px;
3333
3434
}
3535
`}</style>
36-
<button onClick={this.clicked} >Buy Now</button>
36+
37+
<button onClick={this.props.onClick}>
38+
{this.props.children}
39+
</button>
3740
</React.Fragment>
3841
);
3942
}

pages/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ export default class IndexPage extends React.PureComponent {
5050
<Item id={id} name={name} />
5151
))}
5252
</ul>
53-
</main>
54-
53+
</main>
54+
5555
</React.Fragment>
5656
);
5757
}
58-
5958
/**
6059
* This is for demo purposes.
6160
* Once the component has mounted, we fetch items from our API and sets them to state.

0 commit comments

Comments
 (0)