Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gouthamKurapati13 committed Jul 3, 2024
2 parents 08e0246 + d723a61 commit 6ba6538
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Binary file added public/images/products/product1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Components/ItemCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import './style.css'

const ItemCard = ({ itemName, itemPrice, isAddedToCart, quantity: initialQuantity, onAddToCart, onRemoveFromCart }) => {
const ItemCard = ({ itemName, itemImage, itemPrice, isAddedToCart, quantity: initialQuantity, onAddToCart, onRemoveFromCart }) => {
const [quantity, setQuantity] = useState(initialQuantity);

useEffect(() => {
Expand Down Expand Up @@ -32,7 +32,7 @@ const ItemCard = ({ itemName, itemPrice, isAddedToCart, quantity: initialQuantit
<>
<div className="m-4">
<div className="card border-0 rounded-0 shadow card-width">
<img src="https://codingyaar.com/wp-content/uploads/bag-scaled.jpg" className="card-img-top rounded-0" alt="..." />
<img src={`/images/${itemImage}`} className="card-img-top rounded-0" alt="..." />
<div className="card-body mt-3 mb-3">
<div className="d-flex justify-content-between align-items-center">
<h4 className="card-title m-0 p-0">{itemName}</h4>
Expand Down
1 change: 1 addition & 0 deletions src/Pages/Productpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const Productpage = () => {
<ItemCard
key={product.id}
itemName={product.product_name}
itemImage={product.image_url}
itemPrice={parseFloat(product.price)}
isAddedToCart={!!cartItem}
quantity={cartItem ? cartItem.quantity : 1}
Expand Down
1 change: 1 addition & 0 deletions src/drizzle/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const mySchemaUsers = pgTable('users', {
export const mySchemaProducts = pgTable('products', {
id: serial('id').primaryKey(),
product_name: varchar('product_name').notNull(),
image_url: varchar('image_url'),
price: numeric('price').notNull(),
available_quantity: integer('available_quantity').notNull(),
});
Expand Down

0 comments on commit 6ba6538

Please sign in to comment.