This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #2 from brolag/ab/components
Add misc components
- Loading branch information
Showing
16 changed files
with
287 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,19 @@ | ||
import { type ReactNode } from "react"; | ||
|
||
interface ButtonProps { | ||
onClick: () => void; | ||
disabled?: boolean; | ||
children: ReactNode; | ||
} | ||
|
||
export default function Button({ onClick, disabled = false, children }: ButtonProps) { | ||
return ( | ||
<button | ||
disabled={disabled} | ||
onClick={onClick} | ||
className="bg-primary text-secondary w-[8.125rem] rounded-xl p-4 font-bold shadow-md" | ||
> | ||
{children} | ||
</button> | ||
); | ||
} |
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,53 @@ | ||
import React from "react"; | ||
import Image from "next/image"; | ||
import Button from "./Button"; | ||
import { Subtitle } from "./Typography"; | ||
|
||
interface CardProps { | ||
title: string; | ||
description: string; | ||
imageUrl: string; | ||
imageAlt?: string; | ||
price: string; | ||
className?: string; | ||
} | ||
|
||
export default function Card({ | ||
title, | ||
description, | ||
imageUrl, | ||
imageAlt = "Imagen del producto", | ||
price, | ||
className = "", | ||
}: CardProps) { | ||
return ( | ||
<div | ||
className={`card card-compact bg-base-100 shadow-xl ${className} group hover:cursor-pointer`} | ||
> | ||
<div className="relative overflow-hidden"> | ||
<div className="transition-transform duration-300 ease-in-out group-hover:scale-105"> | ||
<Image | ||
src={imageUrl} | ||
alt={imageAlt} | ||
width={400} | ||
height={250} | ||
layout="responsive" | ||
objectFit="cover" | ||
/> | ||
</div> | ||
</div> | ||
<div className="card-body"> | ||
<Subtitle className="card-title">{title}</Subtitle> | ||
<p>{description}</p> | ||
<div className="mt-4 flex items-center justify-between"> | ||
<div className="text-primary text-lg font-bold">{`$${price}`}</div> | ||
<Button | ||
onClick={() => console.log("Comprar")} | ||
> | ||
Add to Cart | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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,43 @@ | ||
import React, { useState } from "react"; | ||
import Button from "./Button"; | ||
|
||
interface HeroProps { | ||
title: string; | ||
description: string; | ||
buttonText: string; | ||
buttonOnClick: (searchTerm: string) => void; | ||
} | ||
|
||
function Hero({ title, description, buttonText, buttonOnClick }: HeroProps) { | ||
const [searchTerm, setSearchTerm] = useState(""); | ||
|
||
const handleSearchClick = () => { | ||
buttonOnClick(searchTerm); | ||
}; | ||
|
||
return ( | ||
<div | ||
className="mb-10 h-2/4 bg-cover bg-center" | ||
style={{ | ||
backgroundImage: "url('/images/bg.webp')", | ||
}} | ||
> | ||
<div className="flex h-full flex-col items-center justify-center bg-black bg-opacity-50 p-4"> | ||
<h1 className="text-center text-5xl font-bold text-white">{title}</h1> | ||
<p className="mt-4 text-center text-xl text-white">{description}</p> | ||
<div className="mt-8 flex w-full max-w-md flex-row items-center justify-center gap-3"> | ||
<input | ||
type="text" | ||
placeholder="Buscar..." | ||
className="input input-bordered w-full max-w-xs" | ||
value={searchTerm} | ||
onChange={(e) => setSearchTerm(e.target.value)} | ||
/> | ||
<Button onClick={handleSearchClick}>{buttonText}</Button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Hero; |
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,56 @@ | ||
import { type ReactNode } from "react"; | ||
|
||
interface TypographyProps { | ||
children: ReactNode; | ||
className?: string; | ||
} | ||
|
||
export function H1({ children, className = "" }: TypographyProps) { | ||
return ( | ||
<h1 | ||
className={`text-primary font-roboto text-4xl font-bold md:text-5xl lg:text-6xl ${className}`} | ||
> | ||
{children} | ||
</h1> | ||
); | ||
} | ||
|
||
export function H2({ children, className = "" }: TypographyProps) { | ||
return ( | ||
<h2 | ||
className={`text-primary font-roboto text-3xl font-semibold md:text-4xl lg:text-5xl ${className}`} | ||
> | ||
{children} | ||
</h2> | ||
); | ||
} | ||
|
||
export function H3({ children, className = "" }: TypographyProps) { | ||
return ( | ||
<h3 | ||
className={`text-primary font-roboto text-2xl font-medium md:text-3xl lg:text-4xl ${className}`} | ||
> | ||
{children} | ||
</h3> | ||
); | ||
} | ||
|
||
export function Subtitle({ children, className = "" }: TypographyProps) { | ||
return ( | ||
<p | ||
className={`text-primary font-roboto text-xl font-light md:text-2xl ${className}`} | ||
> | ||
{children} | ||
</p> | ||
); | ||
} | ||
|
||
export function Label({ children, className = "" }: TypographyProps) { | ||
return ( | ||
<span | ||
className={`text-primary font-roboto text-sm font-normal md:text-base ${className}`} | ||
> | ||
{children} | ||
</span> | ||
); | ||
} |
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,79 @@ | ||
const coffeeCards = [ | ||
{ | ||
id: 1, | ||
title: "Café de Especialidad 1", | ||
description: "Descripción del Café de Especialidad 1.", | ||
imageUrl: "/images/cafe1.webp", | ||
imageAlt: "Paquete de Café de Especialidad 1", | ||
}, | ||
{ | ||
id: 2, | ||
title: "Café de Especialidad 2", | ||
description: "Descripción del Café de Especialidad 2.", | ||
imageUrl: "/images/cafe2.webp", | ||
imageAlt: "Paquete de Café de Especialidad 2", | ||
}, | ||
{ | ||
id: 3, | ||
title: "Café de Especialidad 3", | ||
description: "Descripción del Café de Especialidad 3.", | ||
imageUrl: "/images/cafe3.webp", | ||
imageAlt: "Paquete de Café de Especialidad 3", | ||
}, | ||
{ | ||
id: 4, | ||
title: "Café de Especialidad 4", | ||
description: "Descripción del Café de Especialidad 4.", | ||
imageUrl: "/images/cafe4.webp", | ||
imageAlt: "Paquete de Café de Especialidad 4", | ||
}, | ||
{ | ||
id: 5, | ||
title: "Café de Especialidad 5", | ||
description: "Descripción del Café de Especialidad 5.", | ||
imageUrl: "/images/cafe5.webp", | ||
imageAlt: "Paquete de Café de Especialidad 5", | ||
}, | ||
{ | ||
id: 6, | ||
title: "Café de Especialidad 3", | ||
description: "Descripción del Café de Especialidad 3.", | ||
imageUrl: "/images/cafe3.webp", | ||
imageAlt: "Paquete de Café de Especialidad 3", | ||
}, | ||
{ | ||
id: 7, | ||
title: "Café de Especialidad 4", | ||
description: "Descripción del Café de Especialidad 4.", | ||
imageUrl: "/images/cafe4.webp", | ||
imageAlt: "Paquete de Café de Especialidad 4", | ||
}, | ||
{ | ||
id: 8, | ||
title: "Café de Especialidad 5", | ||
description: "Descripción del Café de Especialidad 5.", | ||
imageUrl: "/images/cafe5.webp", | ||
imageAlt: "Paquete de Café de Especialidad 5", | ||
}, | ||
]; | ||
|
||
import React from "react"; | ||
import Card from "~/components/ui/Card"; | ||
|
||
export default function ProductCatalog() { | ||
return ( | ||
<div className="grid grid-cols-1 gap-10 p-6 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4"> | ||
{coffeeCards.map(({ id, title, description, imageUrl, imageAlt }) => ( | ||
<Card | ||
key={id} | ||
title={title} | ||
description={description} | ||
imageUrl={imageUrl} | ||
imageAlt={imageAlt} | ||
price="10.00" | ||
/> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
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