Skip to content

Commit

Permalink
11. buy product then disabled buy button
Browse files Browse the repository at this point in the history
  • Loading branch information
bbandydd committed Jul 28, 2017
1 parent 44c2438 commit 47730cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/containers/Home/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ export default class Content extends Component {
</h4>
</CardSubtitle>
<CardText>{product.desc}</CardText>
<Button color="secondary" onClick={() => this.addToCart(product)}>購買</Button>
<Button
disabled={cart.find(item => item.id === product.id)}
color="secondary"
onClick={() => this.addToCart(product)}
>
購買
</Button>
</CardBlock>
</Card>
</Col>
Expand Down

0 comments on commit 47730cd

Please sign in to comment.