Skip to content

Commit

Permalink
BuyNowButton
Browse files Browse the repository at this point in the history
  • Loading branch information
Pallavi024 committed Jul 11, 2018
1 parent 1f4ffb7 commit 403ab03
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
43 changes: 25 additions & 18 deletions components/buybutton.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
import React from 'react';
import PropTypes from 'prop-types';
/**
*
*
* @export
* @class buybutton
* @augments {React.PureComponent<buybuttonProps>}
* @class BuyNow
* @augments {React.PureComponent<BuyNowProps>}
*/
export default class buybutton extends React.PureComponent {
export default class BuyNow extends React.PureComponent {
/**
* @typedef {object} buybuttonProps
* @property {array} links
*
* @static
* @memberof buybutton
* @typedef {object} BuyNowProps
* @property {function} onClick
*
* @static
* @memberof BuyNow
*/
static propTypes = {
links: PropTypes.arrayOf(
PropTypes.shape({
url: PropTypes.string,
title: PropTypes.string,
})
).isRequired,
};


render() {
return (
<React.Fragment>
<button>Buy Now</button>
<style jsx>{`
button {
background-color: #e33812;
color: white;
padding: 15px 32px;
text-align: center;
display: inline-block;
font-size: 16px;
border-radius: 12px;
}
`}</style>

<button onClick={this.props.onClick}>
{this.props.children}
</button>
</React.Fragment>
);
}
Expand Down
6 changes: 5 additions & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ export default class IndexPage extends React.PureComponent {
<Item id={id} name={name} />
))}
</ul>
<<<<<<< HEAD
</main>

=======
<h2>Buy Now Button</h2>
<buybutton/>
</main>

>>>>>>> 1f4ffb7... buy now button
</React.Fragment>
);
}

/**
* This is for demo purposes.
* Once the component has mounted, we fetch items from our API and sets them to state.
Expand Down

0 comments on commit 403ab03

Please sign in to comment.