Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"prop-types": "^15.5.8",
"prop-types": "^15.6.0",
"react": "^15.5.3",
"react-dom": "^15.5.3"
},
Expand Down
202 changes: 26 additions & 176 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,208 +1,58 @@
import React from "react";
import "./App.css";
import TopNav from "./components/TopNav";
import SubHeader from "./components/SubHeader";
import ImageSlider from "./components/ImageSlider";
import ProductDetail from "./components/ProductDetail";
import Header from "./components/Header";
import Footer from "./components/Footer";



function App(props) {
let products = props.state.products.filter((product)=> {
return product.category === props.currentCategory;
})

return (
<div>
<div className="App">
<div className="wrap">

<div className="header">

<div className="top-header">
<div className="top-header-left">
<ul>
<li className="active"><a href="#">Home</a></li>
<li><a href="#">Specials</a></li>
<li><a href="#">Delivery</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div className="top-header-right">
<ul>
<li><a href="#">CURRENCY:</a></li>
<li>
<select>
<option>Dollar</option>
<option>Euro</option>
<option>Pound</option>
</select>
</li>
</ul>
</div>

<Header />
<div className="clear"> </div>
</div>
<div className="clear"> </div>
<div className="sub-header">
<div className="logo">
<a href="index.html"><img src="images/logo.png" title="logo" /></a>
</div>
<div className="sub-header-right">
<ul>
<li><a href="#">log in</a></li>
<li><a href="#">Your account</a></li>
<li><a href="#">CART: (EMPTY) <img src="images/cart.png" title="cart" /></a></li>
</ul>
<input type="text" /><input type="submit" value="search" />
</div>
<div className="clear"> </div>
</div>
<SubHeader />
<div className="clear"> </div>
<div className="top-nav">
<ul>
<li><a href="carlights.html">car lights</a></li>
<li><a href="carwheels.html">Car wheels</a></li>
<li><a href="carbumpers.html">car bumpers</a></li>
<li><a href="caradsystem.html">car audiosystem</a></li>
<li><a href="truckbumpers.html">Truck bumpers</a></li>
<li><a href="contact.html">Feedback</a></li>
<div className="clear"> </div>
</ul>
</div>

<TopNav changeCategory={props.changeCategory} />

</div>


<div className="image-slider">

<ul className="rslides" id="slider1">
<li><img src="images/slider1.jpg" alt="" /></li>
<li><img src="images/slider3.jpg" alt="" /></li>
<li><img src="images/slider1.jpg" alt="" /></li>
</ul>

</div>


<ImageSlider />

<div className="content">
<div className="products-box">
<div className="products">
<h5><span>FEATURED</span> PRODUCTS</h5>
<div className="section group">
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g3.png" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4>$512.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g1.jpg" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4>$300.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g2.jpg" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4>$120.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g3.png" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4>$500.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g4.jpg" />
<h3>Lorem Ipsum is simply</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4>$120.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<ProductDetail products={products}/>
</div>
</div>
<div className="products products-secondbox">
<h5><span>Our</span> Specials</h5>
<div className="section group">
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g1.jpg" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4><span>$600.00</span>$512.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g6.jpg" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4><span>$400.00</span>$352.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g7.png" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4><span>$300.00</span>$202.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g8.png" />
<h3>Lorem Ipsum is simply </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4><span>$400.00</span>$322.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<div className="grid_1_of_5 images_1_of_5">
<img src="images/g1.jpg" />
<h3>Lorem Ipsum is simply</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, in reprehenderit.</p>
<h4><span>$700.00</span>$602.00</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>
<ProductDetail products={products} />
</div>
</div>
</div>
</div>
<div className="clear"> </div>
<div className="footer">
<div className="section group">
<div className="col_1_of_4 span_1_of_4">
<h3>INFORMATION</h3>
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">Sitemap</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Terms and conditions</a></li>
<li><a href="#">Legal Notice</a></li>
</ul>
</div>
<div className="col_1_of_4 span_1_of_4">
<h3>OUR OFFERS</h3>
<ul>
<li><a href="#">New products</a></li>
<li><a href="#">top sellers</a></li>
<li><a href="#">Specials</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Comments</a></li>
</ul>
</div>
<div className="col_1_of_4 span_1_of_4">
<h3>YOUR ACCOUNT</h3>
<ul>
<li><a href="#">Your Account</a></li>
<li><a href="#">Personal info</a></li>
<li><a href="#">Prices</a></li>
<li><a href="#">Address</a></li>
<li><a href="#">Locations</a></li>
</ul>
</div>
<div className="col_1_of_4 span_1_of_4 footer-lastgrid">
<h3>Get in touch</h3>
<ul>
<li><a href="#"><img src="images/facebook.png" title="facebook" /></a></li>
<li><a href="#"><img src="images/twitter.png" title="Twiiter" /></a></li>
<li><a href="#"><img src="images/rss.png" title="Rss" /></a></li>
<li><a href="#"><img src="images/gpluse.png" title="Google+" /></a></li>
</ul>
<p>Design by <a href="#">W3layouts</a></p>
</div>
</div>
</div>
<Footer />
</div>

</div>
);
}
Expand Down
52 changes: 52 additions & 0 deletions src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from "react";

function Footer (props) {
return (
<div className="footer">
<div className="section group">
<div className="col_1_of_4 span_1_of_4">
<h3>INFORMATION</h3>
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">Sitemap</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Terms and conditions</a></li>
<li><a href="#">Legal Notice</a></li>
</ul>
</div>
<div className="col_1_of_4 span_1_of_4">
<h3>OUR OFFERS</h3>
<ul>
<li><a href="#">New products</a></li>
<li><a href="#">top sellers</a></li>
<li><a href="#">Specials</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Comments</a></li>
</ul>
</div>
<div className="col_1_of_4 span_1_of_4">
<h3>YOUR ACCOUNT</h3>
<ul>
<li><a href="#">Your Account</a></li>
<li><a href="#">Personal info</a></li>
<li><a href="#">Prices</a></li>
<li><a href="#">Address</a></li>
<li><a href="#">Locations</a></li>
</ul>
</div>
<div className="col_1_of_4 span_1_of_4 footer-lastgrid">
<h3>Get in touch</h3>
<ul>
<li><a href="#"><img src="images/facebook.png" title="facebook" /></a></li>
<li><a href="#"><img src="images/twitter.png" title="Twiiter" /></a></li>
<li><a href="#"><img src="images/rss.png" title="Rss" /></a></li>
<li><a href="#"><img src="images/gpluse.png" title="Google+" /></a></li>
</ul>
<p>Design by <a href="#">W3layouts</a></p>
</div>
</div>
</div>
)
}

export default Footer;
28 changes: 26 additions & 2 deletions src/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
import React from "react";

function Header() {
return (<div />);
function Header (props) {
return (
<div className="top-header">
<div className="top-header-left">
<ul>
<li className="active"><a href="#">Home</a></li>
<li><a href="#">Specials</a></li>
<li><a href="#">Delivery</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div className="top-header-right">
<ul>
<li><a href="#">CURRENCY:</a></li>
<li>
<select>
<option>Dollar</option>
<option>Euro</option>
<option>Pound</option>
</select>
</li>
</ul>
</div>
<div className="clear"> </div>
</div>
)
}

export default Header;
17 changes: 17 additions & 0 deletions src/components/ImageSlider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";

function ImageSlider (props) {
return (
<div className="image-slider">

<ul className="rslides" id="slider1">
<li><img src="images/slider1.jpg" alt="" /></li>
<li><img src="images/slider3.jpg" alt="" /></li>
<li><img src="images/slider1.jpg" alt="" /></li>
</ul>

</div>
)
}

export default ImageSlider;
32 changes: 32 additions & 0 deletions src/components/ProductDetail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import PropTypes from "prop-types";

function ProductDetail (props) {


let displayProducts = props.products.map((product)=> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically this is fine, but ProductDetail is suppose to represent one product
the map should happen in App because that is where the decision is made to show multiple products

return (
<div className="grid_1_of_5 images_1_of_5" key={product.id}>
{console.log([product.name, product.description])}
<img src={product.imgUrl} />
<h3>{product.name}</h3>
<p>{product.description}</p>
<h4>{product.price}</h4>
<div className="button"><span><a href="singlepage.html">Read More</a></span></div>
</div>

)
})

return (
<div>
{displayProducts}
</div>
)
}

ProductDetail.PropTypes = {
products: PropTypes.array.isRequired
}

export default ProductDetail;
Loading