From 19c9683e2126c68cb9d231293162c756d69c51fb Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 8 Feb 2018 10:41:16 -0500 Subject: WIP --- frontend/components/Item.js | 114 +++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 59 deletions(-) (limited to 'frontend/components/Item.js') diff --git a/frontend/components/Item.js b/frontend/components/Item.js index eb19918..d19af0e 100644 --- a/frontend/components/Item.js +++ b/frontend/components/Item.js @@ -1,10 +1,13 @@ -import styled from "styled-components"; -import slugify from "slugify"; -import { Link } from "../routes"; -import AddToCart from "./AddToCart"; -import makeImage from "../lib/image"; -import TakeMyMoney from "./TakeMyMoney"; -import formatMoney from "../lib/formatMoney"; +import React from 'react'; +import styled from 'styled-components'; +import slugify from 'slugify'; +import { compose } from 'react-apollo'; +import { Link } from '../routes'; +import AddToCart from './AddToCart'; +import makeImage from '../lib/image'; +import TakeMyMoney from './TakeMyMoney'; +import formatMoney from '../lib/formatMoney'; +import { removeItemMutation } from '../enhancers/enhancers'; const Item = styled.div` background: #f3f3f3; @@ -14,60 +17,53 @@ const Item = styled.div` } `; -const ItemComponent = ({ item }) => ( - - {item.image ? ( - {item.title} - ) : null} -

- - {item.title} - -

+class ItemComponent extends React.Component { + removeItem = () => { + this.props.removeItem({ variables: { id: this.props.item.id } }); + }; + render() { + const item = this.props.item; + return ( + + {item.image ? {item.title} : null} +

+ + {item.title} + +

-

{item.description}

- {/* { +

{item.description}

- - Edit ✏️ - + + Edit ✏️ + - } */} + + + - - - - - - -
-); + {/* */} + +
+ ); + } +} -export default ItemComponent; +export default compose(removeItemMutation)(ItemComponent); -- cgit v1.3