From af88c133b13d9c1a4b52afb47bb613cc717a53d9 Mon Sep 17 00:00:00 2001 From: Senad Uka Date: Wed, 4 Feb 2015 06:38:22 +0100 Subject: [PATCH] non fuctional add to cart part created --- front-ui/app/components/cart/addToCart.js | 40 +++++++++++++++++++ .../components/items/itemWithDetailsPage.js | 6 ++- front-ui/app/components/items/singleItem.js | 2 +- front-ui/app/css/cart.css | 3 ++ front-ui/app/css/items.css | 12 +++--- 5 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 front-ui/app/components/cart/addToCart.js create mode 100644 front-ui/app/css/cart.css diff --git a/front-ui/app/components/cart/addToCart.js b/front-ui/app/components/cart/addToCart.js new file mode 100644 index 0000000..224e4d7 --- /dev/null +++ b/front-ui/app/components/cart/addToCart.js @@ -0,0 +1,40 @@ +var React = require('react'); + + +var AddToCart = React.createClass({ + + render: function() { + return ( +
+
+
+
+
+
+ ); + }, + + // Add change listeners to stores + componentDidMount: function() { + /*ItemActions.loadFrontPageItems(); + ItemStore.addChangeListener(this._onChange); */ + }, + + + getInitialState: function() { + return { + //items: ItemStore.getItems() + } + }, + + + _onChange: function () { + if (this.isMounted()) { + /* this.setState({ + items: ItemStore.getItems() + }); */ + } + }, +}); + +module.exports = AddToCart; diff --git a/front-ui/app/components/items/itemWithDetailsPage.js b/front-ui/app/components/items/itemWithDetailsPage.js index 4af8846..3d314c5 100644 --- a/front-ui/app/components/items/itemWithDetailsPage.js +++ b/front-ui/app/components/items/itemWithDetailsPage.js @@ -3,7 +3,8 @@ var React = require('react'), Traits = require('../items/traits'), ItemDetailsActions = require('../../actions/itemDetailsActions'), NavigationStore = require('../../stores/navigationStore'), - ItemDetailsStore = require('../../stores/itemDetailsStore'); + ItemDetailsStore = require('../../stores/itemDetailsStore'), + AddToCart = require('../cart/addToCart'); var Router = require('react-router'); @@ -13,6 +14,7 @@ var ItemWithDetailsPage = React.createClass({ render: function() { return ( +
+
@@ -32,6 +35,7 @@ var ItemWithDetailsPage = React.createClass({
+ ); diff --git a/front-ui/app/components/items/singleItem.js b/front-ui/app/components/items/singleItem.js index 2bad435..a1dffb3 100644 --- a/front-ui/app/components/items/singleItem.js +++ b/front-ui/app/components/items/singleItem.js @@ -13,7 +13,7 @@ var SingleItem = React.createClass({ firstImage = firstImage || { url: "http://res.cloudinary.com/lfvt7ps2n/image/upload/c_crop,g_center,w_300/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ; return (
- +

{ this.props.item.get('name') }

{ this.props.item.get('list_price') } KM
diff --git a/front-ui/app/css/cart.css b/front-ui/app/css/cart.css new file mode 100644 index 0000000..5d5d02d --- /dev/null +++ b/front-ui/app/css/cart.css @@ -0,0 +1,3 @@ +.add-to-cart { + padding-top: 20px; +} \ No newline at end of file diff --git a/front-ui/app/css/items.css b/front-ui/app/css/items.css index 3842011..cd1321e 100644 --- a/front-ui/app/css/items.css +++ b/front-ui/app/css/items.css @@ -7,11 +7,6 @@ } -.single_trait { - display: inline-block; - text-align: center; - padding-right: 5px; -} .single_item img { padding: 5px; @@ -25,5 +20,10 @@ .single_item h1 { font-size: 15px; text-decoration: bold; +} -} \ No newline at end of file +.single_trait { + display: inline-block; + text-align: center; + padding-right: 5px; +}