-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from calblueprint/celine/individual-item-pages
Individual Item Description Pages
- Loading branch information
Showing
15 changed files
with
295 additions
and
133 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useState } from 'react'; | ||
import { | ||
ButtonsWrapper, | ||
AddToCartButton, | ||
QuantityButton, | ||
PlusMinusButton, | ||
} from './styles'; | ||
|
||
export default function Buttons() { | ||
const [quantity, setQuantity] = useState<number>(1); | ||
|
||
const increaseQuantity = () => { | ||
setQuantity(quantity + 1); | ||
}; | ||
|
||
const decreaseQuantity = () => { | ||
if (quantity > 1) { | ||
setQuantity(quantity - 1); | ||
} | ||
}; | ||
|
||
// used hyphen instead of dash for display | ||
return ( | ||
<ButtonsWrapper> | ||
<QuantityButton> | ||
<PlusMinusButton type="button" onClick={decreaseQuantity}> | ||
– | ||
</PlusMinusButton> | ||
<span>{quantity}</span> | ||
<PlusMinusButton type="button" onClick={increaseQuantity}> | ||
+ | ||
</PlusMinusButton> | ||
</QuantityButton> | ||
<AddToCartButton>Add to cart</AddToCartButton> | ||
</ButtonsWrapper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
'use client'; | ||
|
||
import Link from 'next/link'; | ||
import Image from 'next/image'; | ||
import { useEffect, useState } from 'react'; | ||
import { fetchProductByID } from '../../api/supabase/queries/product_queries'; | ||
import { | ||
BackButton, | ||
ImageContainer, | ||
TextContainer, | ||
DescriptionContainer, | ||
} from './styles'; | ||
import { GlobalStyle } from '../../styles/components'; | ||
import NavBar from '../../components/NavBar'; | ||
import { Product } from '../../schema/schema'; | ||
import Buttons from './Buttons'; | ||
|
||
export default function ItemDisplay({ | ||
params, | ||
}: { | ||
params: { productId: number }; | ||
}) { | ||
const [Item, setItem] = useState<Product>(); | ||
|
||
useEffect(() => { | ||
async function fetchProducts() { | ||
try { | ||
const response = await fetchProductByID(params.productId); | ||
if (response) { | ||
setItem(response); | ||
} | ||
} catch (error) { | ||
// console.error(error); | ||
} | ||
} | ||
|
||
fetchProducts(); | ||
}, [params.productId]); | ||
|
||
return ( | ||
<main> | ||
<GlobalStyle /> | ||
<NavBar /> | ||
<BackButton> | ||
<Link href="/storefront"> | ||
<Image | ||
src="/images/Arrow_Left_MD.png" | ||
alt="Back Arrow" | ||
width={20} | ||
height={20} | ||
/> | ||
<span style={{ marginLeft: '8px' }}>Back</span> | ||
</Link> | ||
</BackButton> | ||
<DescriptionContainer> | ||
<ImageContainer> | ||
<img | ||
src={Item?.photo} | ||
alt={Item?.name} | ||
style={{ width: '600px', height: '600px' }} | ||
/> | ||
</ImageContainer> | ||
<TextContainer> | ||
<h1>{Item?.name}</h1> | ||
<h4 style={{ fontWeight: 'normal', paddingTop: '5px' }}> | ||
{Item?.category} | ||
</h4> | ||
<Buttons /> | ||
<p style={{ paddingTop: '50px' }}>Product ID: {Item?.product_id}</p> | ||
<p style={{ paddingTop: '20px' }}>Product Details:</p> | ||
<p>{Item?.description}</p> | ||
</TextContainer> | ||
</DescriptionContainer> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import styled from 'styled-components'; | ||
import COLORS from '../../styles/colors'; | ||
|
||
export const BackButton = styled.button` | ||
display: flex; | ||
padding-top: 230px; | ||
padding-left: 30px; | ||
width: 100px; | ||
height: 40px; | ||
background-color: transparent; | ||
border-color: transparent; | ||
font-size: 15px; | ||
`; | ||
|
||
export const DescriptionContainer = styled.div` | ||
display: flex; | ||
margin: 50px; | ||
width: 1440px; | ||
height: 800px; | ||
`; | ||
|
||
export const ImageContainer = styled.div` | ||
margin: 50px; | ||
width: 666px; | ||
height: 666px; | ||
flex-shrink: 0; | ||
`; | ||
|
||
export const TextContainer = styled.div` | ||
margin-left: 70px; | ||
width: 440px; | ||
height: 350px; | ||
`; | ||
|
||
export const ButtonsWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 450px; | ||
height: 50px; | ||
margin-top: 20px; | ||
`; | ||
|
||
export const QuantityButton = styled.div` | ||
display: flex; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
width: 165px; | ||
height: 50px; | ||
border-radius: 8px; | ||
background-color: ${COLORS.white}; | ||
border: 2px solid ${COLORS.navy}; | ||
color: ${COLORS.navy}; | ||
`; | ||
|
||
export const PlusMinusButton = styled.button` | ||
width: 25px; | ||
height: 25px; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: transparent; | ||
border-color: transparent; | ||
font-size: 20px; | ||
color: ${COLORS.navy}; | ||
`; | ||
export const AddToCartButton = styled.button` | ||
width: 265px; | ||
height: 50px; | ||
border-radius: 8px; | ||
background-color: ${COLORS.navy}; | ||
font-family: Public Sans; | ||
font-size: 20px; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: normal; | ||
color: ${COLORS.white}; | ||
border-color: transparent; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7ba4589
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
shanti-project – ./
shanti-project-phi.vercel.app
shanti-project-git-main-celine-ji-won-chois-projects.vercel.app
shanti-project-celine-ji-won-chois-projects.vercel.app