From b1600adec47a04f60e1da07d94a3ed3906ff5aee Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 14 Jun 2018 16:44:21 -0400 Subject: starter files --- finished-application/frontend/components/Item.js | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 finished-application/frontend/components/Item.js (limited to 'finished-application/frontend/components/Item.js') diff --git a/finished-application/frontend/components/Item.js b/finished-application/frontend/components/Item.js new file mode 100644 index 0000000..d6b339e --- /dev/null +++ b/finished-application/frontend/components/Item.js @@ -0,0 +1,53 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Link from 'next/link'; +import Title from './styles/Title'; +import AddToCart from './AddToCart'; +import DeleteItem from './DeleteItem'; +import formatMoney from '../lib/formatMoney'; +import ItemStyles from './styles/ItemStyles'; +import PriceTag from './styles/PriceTag'; + +class Item extends React.Component { + static propTypes = { + item: PropTypes.object.isRequired, + }; + + render() { + const item = this.props.item; + return ( + + {item.image && {item.title}} + + <Link + href={{ + pathname: '/item', + query: { id: item.id }, + }} + > + <a>{item.title}</a> + </Link> + + + {formatMoney(item.price)} + +

{item.description}

+ +
+ + Edit ✏️ + + + +
+
+ ); + } +} + +export default Item; -- cgit v1.3