-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 181-agregar-dashboard
- Loading branch information
Showing
8 changed files
with
173 additions
and
22 deletions.
There are no files selected for viewing
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,78 @@ | ||
import { ProductDetail } from '~/types/products'; | ||
import { Brand } from '~/types/products'; | ||
import { GoDotFill } from 'react-icons/go'; | ||
import { AiFillHeart } from 'react-icons/ai'; | ||
import { AiOutlineShopping } from 'react-icons/ai'; | ||
import { AiOutlineShoppingCart } from 'react-icons/ai'; | ||
import Link from 'next/link'; | ||
import { FC, useEffect, useState } from 'react'; | ||
export const BuyDetail: FC<ProductDetail> = (product) => { | ||
const [brand, setBrand] = useState(''); | ||
|
||
useEffect(() => { | ||
const fetchBrand = async () => { | ||
const response = await fetch('http://localhost:3001/brands'); | ||
const brands = await response.json(); | ||
const brandFiltered = brands.find( | ||
(brand: Brand) => brand.id === product.brandId | ||
); | ||
|
||
setBrand(brandFiltered.name); | ||
}; | ||
|
||
fetchBrand(); | ||
}, [product.brandId]); | ||
|
||
return ( | ||
<div className="w-full h-[79%] my-auto ms:w-5/6 flex flex-col justify-between"> | ||
<div className="flex w-full justify-between"> | ||
<p className="flex items-center text-secondary-lm"> | ||
{product.stock > 0 ? ( | ||
<GoDotFill color={'green'} /> | ||
) : ( | ||
<GoDotFill color={'red'} /> | ||
)} | ||
{product.stock > 0 ? 'Con stock' : 'Sin stock'} | ||
</p> | ||
<p className="flex items-center gap-x-1 font-medium"> | ||
Agregar a favoritos <AiFillHeart color={'red'} /> | ||
</p> | ||
</div> | ||
<p className="text-bold text-2xl font-black">{product.title}</p> | ||
<div className="w-full font-medium"> | ||
<p className="text-primary-lm">Marca:</p> | ||
<p>{brand}</p> | ||
</div> | ||
<div className="w-full font-medium"> | ||
<p className="text-primary-lm">Tiempo de entrega:</p> | ||
<p>10 / 15 Días hábiles</p> | ||
</div> | ||
<div className="w-full"> | ||
<p className="line-through text-xl text-primary-dm font-extralight"> | ||
${product.price - product.price * 0.1} | ||
</p> | ||
<p className="text-2xl text-secondary-lm font-black"> | ||
${product.price} | ||
</p> | ||
</div> | ||
<div className="w-full flex justify-between"> | ||
<button className="w-[49%] bg-secondary-lm text-white rounded p-1 flex items-center justify-center gap-x-1 font-bold"> | ||
Comprar | ||
<AiOutlineShopping size={25} /> | ||
</button> | ||
<button className="w-[49%] bg-primary-lm text-white rounded p-1 flex items-center justify-center gap-x-1"> | ||
Añadir al carrito | ||
<AiOutlineShoppingCart size={25} /> | ||
</button> | ||
</div> | ||
<p className="font-light"> | ||
Envio gratis por compras superiores a $200.000 | ||
</p> | ||
<p>¿Tienes alguna pregunta? Consulta con un especialista</p> | ||
<Link href={'/contact'} className="text-primary-lm"> | ||
Contactanos | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
export default BuyDetail; |
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,68 @@ | ||
interface Brand { | ||
id: string; | ||
name: string; | ||
} | ||
|
||
interface Category { | ||
id: string; | ||
name: string; | ||
} | ||
|
||
interface Products { | ||
id: string; | ||
title: string; | ||
state: string; | ||
stock: number; | ||
price: number; | ||
availability: number; | ||
image: string[]; | ||
model: string; | ||
year: string; | ||
brand: Brand; | ||
category: Category; | ||
description: String; | ||
} | ||
export const product:Products[] = [ | ||
{ | ||
id: 'MCO564861395', | ||
title: 'Farola Hyundai I35 Elantra 2012 - 2016 tipo OEM Halogena', | ||
state: 'Inactiva', | ||
stock: 26, | ||
price: 1079900, | ||
availability: 10, | ||
image: ['https://i.ebayimg.com/images/g/rcgAAOSw~2Jjhupf/s-l1600.jpg'], | ||
model: 'Elantra', | ||
year: '2012 a 2016', | ||
brand: { | ||
id: '425dee5e-5b8a-4d95-9a7b-90bc90ced574', | ||
name: 'Hyundai', | ||
}, | ||
category: { | ||
id: '7f1a877c-67d5-4ab5-9a32-01405f41a74e', | ||
name: 'Farolas', | ||
}, | ||
description: ` BA9S T4W 363 1895 233 Super brillante redondo 3D COB LED blanco luces de matrícula de coche bombilla Moto lámpara marcador luz DC 12V | ||
Descripción: | ||
Modelo: Ba9s | ||
Voltaje: 12V DC | ||
Actual: 0.05A | ||
Tamaño: 2,45 cm * 0,8 cm (0,96 "* 0,31") | ||
Lúmenes de flujo: 200LM | ||
Color: blanco (6000K-6500K) | ||
Referencia cruzada: BA9S: 53, 57, 182, 257, 1895, 6253, 64111, 64113 ,T11 T4W... | ||
Aplicación: indicador luminoso de grupo de indicadores, luces de estacionamiento, luces traseras, luces de mapa, luces de escenario, luces de maletero, lámpara de placa de matrícula, luz de señal de giro, luz de curva, luz de indicador lateral, luz trasera y luces de respaldo, etc | ||
Paquete incluye: | ||
1x Ba9s bombilla Led | ||
Bajo consumo de energía y baja temperatura. | ||
Vida útil de larga duración: 50000 horas de trabajo. | ||
LED ultrabrillante, color único y más vivo. | ||
Fácil instalación, solo tienes que conectarlo y jugar. ` | ||
}, | ||
] |
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