-
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.
- Loading branch information
Showing
9 changed files
with
133 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- CreateTable | ||
CREATE TABLE "Book" ( | ||
"id" TEXT NOT NULL, | ||
"authors" TEXT[], | ||
"image" TEXT NOT NULL, | ||
"title" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Book_pkey" PRIMARY KEY ("id") | ||
); |
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,25 @@ | ||
import { Card, CardBody, CardFooter, Image } from '@nextui-org/react' | ||
|
||
export interface BookProps { | ||
authors: string[] | ||
image: string | ||
title: string | ||
} | ||
|
||
export default function Book(props: BookProps) { | ||
const { authors, image, title } = props | ||
|
||
return ( | ||
<> | ||
<Card className="max-w-[320px]"> | ||
<CardBody> | ||
<Image alt={title} width={297} height={387} src={image} /> | ||
</CardBody> | ||
<CardFooter className="flex flex-col items-start"> | ||
<div className="text-xl font-bold">{title}</div> | ||
<div className="text-sm">{authors.join(', ')}</div> | ||
</CardFooter> | ||
</Card> | ||
</> | ||
) | ||
} |
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,49 @@ | ||
'use client' | ||
|
||
import { Divider, Input } from '@nextui-org/react' | ||
|
||
import SubmitButton from '@/components/SubmitButton/SubmitButton' | ||
|
||
export default function BookForm() { | ||
return ( | ||
<> | ||
<form className="flex flex-col gap-4"> | ||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mt-4 w-full"> | ||
<Input | ||
label="Título" | ||
labelPlacement="outside" | ||
name="title" | ||
placeholder="Título" | ||
radius="none" | ||
size="lg" | ||
isRequired | ||
/> | ||
<Input | ||
label="Autores" | ||
labelPlacement="outside" | ||
name="authors" | ||
placeholder="Autores" | ||
radius="none" | ||
size="lg" | ||
isRequired | ||
description="Separados por comas" | ||
/> | ||
<Input | ||
label="Imagen" | ||
labelPlacement="outside" | ||
name="image" | ||
placeholder="Imagen" | ||
radius="none" | ||
size="lg" | ||
isRequired | ||
description="Introduzca la url de la portada del libro" | ||
/> | ||
<Divider className="col-span-1 md:col-span-2" /> | ||
</div> | ||
<div className="flex flex-row-reverse"> | ||
<SubmitButton /> | ||
</div> | ||
</form> | ||
</> | ||
) | ||
} |
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 { Meta, StoryObj } from '@storybook/react' | ||
|
||
import Book from '@/components/Book/Book' | ||
|
||
const meta = { | ||
component: Book, | ||
title: 'Components/Book', | ||
} satisfies Meta<typeof Book> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Basic: Story = { | ||
args: { | ||
authors: ['Martin Kleppmann'], | ||
image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg', | ||
title: 'Designing Data-Intensive Applications', | ||
}, | ||
} |
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,13 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
|
||
import BookForm from '@/components/BookForm/BookForm' | ||
|
||
const meta = { | ||
component: BookForm, | ||
title: 'Components/BookForm', | ||
} satisfies Meta<typeof BookForm> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Basic: Story = {} |