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
35 changes: 19 additions & 16 deletions client/src/components/Category/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
import React from "react";
import "./style.css";
import axios from "axios";
import React from 'react'
import './style.css'
import axios from 'axios'
import { Link } from 'react-router-dom'
class Category extends React.Component {
state = {
result: []
};
}
componentDidMount() {
axios.get("/category").then(result => {
const resultArray = result.data.map(e => e);
this.setState({ result: resultArray });
});
axios.get('/category').then(result => {
const resultArray = result.data.map(e => e)
this.setState({ result: resultArray })
})
}

render() {
return (
<div className="grid-container">
{!this.state.result.length ? (

<img
className="loading"
src="https://media1.tenor.com/images/556e9ff845b7dd0c62dcdbbb00babb4b/tenor.gif?itemid=5300368"
alt="loading"
/>
) : (
this.state.result.map(e => (
<Link to={'/shop/'+e.id }>
<div onClick={this.props.onClick}>
<img className="grid-item" src={e.img} alt = {e.name+" image"} />
<p className="category">{e.name}</p>
</div>
<Link to={'/shop/' + e.id} key={e.id}>
<div onClick={this.props.onClick}>
<img
className="grid-item"
src={e.img}
alt={e.name + ' image'}
/>
<p className="category">{e.name}</p>
</div>
</Link>
))
)}
</div>
);
)
}
}
export default Category;
export default Category
2 changes: 1 addition & 1 deletion client/src/components/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component } from 'react'
import './style.css'
import { Link } from 'react-router-dom'

class NavBar extends React.Component {
class NavBar extends Component {
state = { toggleMenu: false }

onClick1 = () => {
Expand Down
10 changes: 5 additions & 5 deletions client/src/components/Product_card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import './style.css'
import axios from 'axios'
import { Link } from 'react-router-dom'

class ProductCard extends React.Component {
class ProductCard extends Component {
state = {
products: [],
loading: true,
path1:"/shop"
path1: '/shop'
}

componentDidMount() {
this.setState({path1:this.props.path})
this.setState({ path1: this.props.path })
if (this.props.match.params.id) {
axios.get(`/shop/${this.props.match.params.id}`).then(({ data }) => {
this.setState({ products: data, loading: false })
Expand All @@ -28,7 +28,7 @@ class ProductCard extends React.Component {
}

render() {
const { products, loading, searchedProducts } = this.state
const { products, loading } = this.state
const myProducts = this.props.resultAfterSerch
? this.props.resultAfterSerch
: products
Expand All @@ -37,7 +37,7 @@ class ProductCard extends React.Component {
{!loading ? (
myProducts.length > 0 ? (
myProducts.map(e => (
<Link to={'/product/' + e.id + this.state.path1} key = {e.id} >
<Link to={'/product/' + e.id + this.state.path1} key={e.id}>
<div className="cards">
<div className="product-card-back">
<div className="product-card">
Expand Down
11 changes: 8 additions & 3 deletions client/src/components/Search_bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ class SearchBar extends Component {
render() {
return (
<div className="search-bar">
<input className="search-bar"
<input
className="search-bar"
type="text"
placeholder="Search.."
name="search2"
onChange={this.props.searchProduct}
value={this.props.searchInput}
/>
<button className="search-bar" onClick={this.getSearchedProduct} type="button">
<i class="fa fa-search"></i>
<button
className="search-bar"
onClick={this.getSearchedProduct}
type="button"
>
<i className="fa fa-search"></i>
</button>
</div>
)
Expand Down
11 changes: 9 additions & 2 deletions client/src/components/about_us/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ const aboutUs = () => {
return (
<div className="pageAboutUs">
<NavBar />
<img className ="superMarket"src="https://2.top4top.net/p_1348iki641.jpg"></img>
<img
className="superMarket"
src="https://2.top4top.net/p_1348iki641.jpg"
alt="about us"
></img>
<h1 className="aboutUs">About us :</h1>
<p className="description">Its a supermarket website we have many components you can order any thing when you in home, work. Its a esay way to buy anything.</p>
<p className="description">
Its a supermarket website we have many components you can order any
thing when you in home, work. Its a esay way to buy anything.
</p>
</div>
)
}
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
"build": "cd client && npm run build",
"eject": "react-scripts eject",
"client-install": "cd client && npm install"




},
"repository": {
"type": "git",
Expand Down