diff --git a/src/components/book-grid/index.tsx b/src/components/book-grid/index.tsx
index 494c176..bc50eaa 100644
--- a/src/components/book-grid/index.tsx
+++ b/src/components/book-grid/index.tsx
@@ -1,16 +1,19 @@
-import Book from '@/components/book'
+import BookCard from '@/components/book-card/book-card'
import BookResponse from '@/core/book/dto/responses/book.response'
+import UserResponse from '@/core/user/dto/responses/user.response'
export interface BookGridProperties {
books: BookResponse[]
+ me?: UserResponse
}
export default function BookGrid(properties: BookGridProperties) {
+ const { books, me } = properties
return (
<>
-
- {properties.books.map((book) => (
-
+
+ {books.map((book) => (
+
))}
>
diff --git a/src/components/edit-profile-form/index.tsx b/src/components/edit-profile-form/index.tsx
index 3dc1330..d626662 100644
--- a/src/components/edit-profile-form/index.tsx
+++ b/src/components/edit-profile-form/index.tsx
@@ -37,7 +37,7 @@ export default function EditProfileForm(properties: EditProfileFormProperties) {
name="name"
defaultValue={state.data?.name || ''}
isRequired
- errors={state.errors}
+ state={state}
/>
diff --git a/src/components/footer/footer.tsx b/src/components/footer/footer.tsx
new file mode 100644
index 0000000..542ef64
--- /dev/null
+++ b/src/components/footer/footer.tsx
@@ -0,0 +1,35 @@
+import { Link, Navbar, NavbarContent, NavbarItem } from '@nextui-org/react'
+
+import ThemeImage from '@/components/theme-image'
+
+export default function Footer() {
+ return (
+ <>
+
+
+
+
+ Desarrollado por el{' '}
+
+ Aula de Software Libre
+
+ .
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
diff --git a/src/components/header/index.tsx b/src/components/header/index.tsx
index 459dde5..c936d9a 100644
--- a/src/components/header/index.tsx
+++ b/src/components/header/index.tsx
@@ -28,7 +28,7 @@ export default function Header(properties: HeaderProperties) {
return (
<>
-
+
Codex
diff --git a/src/components/input-form/index.tsx b/src/components/input-form/index.tsx
index 0042d9e..e233d2c 100644
--- a/src/components/input-form/index.tsx
+++ b/src/components/input-form/index.tsx
@@ -1,15 +1,18 @@
'use client'
import { Input, InputProps } from '@nextui-org/react'
-import { ZodIssue } from 'zod'
+
+import FormResponse from '@/lib/zod/form-response'
type FormInputProperties = InputProps & {
- errors?: ZodIssue[]
label: string
+ state: FormResponse
}
export default function InputForm(properties: FormInputProperties) {
- const { errors = [], label, name, ...rest } = properties
+ const { label, name, state, ...rest } = properties
+
+ const errors = state.success ? [] : state.errors
const errorMessage = errors
.filter((error) => error.path[0] === name)
diff --git a/src/components/sign-in-email-form/index.tsx b/src/components/sign-in-email-form/index.tsx
index e0a75aa..6e077a9 100644
--- a/src/components/sign-in-email-form/index.tsx
+++ b/src/components/sign-in-email-form/index.tsx
@@ -34,7 +34,7 @@ export default function SignInEmailForm() {
type="email"
placeholder="Introduce tu email"
variant="bordered"
- errors={state.errors}
+ state={state}
defaultValue={state.data.email}
/>
>
)
diff --git a/stories/components/book-card.stories.ts b/stories/components/book-card.stories.ts
new file mode 100644
index 0000000..4881acb
--- /dev/null
+++ b/stories/components/book-card.stories.ts
@@ -0,0 +1,68 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import BookCard from '@/components/book-card/book-card'
+import BookResponse from '@/core/book/dto/responses/book.response'
+import UserResponse from '@/core/user/dto/responses/user.response'
+import gravatar from '@/lib/utils/gravatar'
+
+const meta = {
+ component: BookCard,
+ title: 'Components/BookCard',
+} satisfies Meta
+
+export default meta
+type Story = StoryObj
+
+export const Available: Story = {
+ args: {
+ book: {
+ authors: ['Martin Kleppmann'],
+ id: '23423432',
+ image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
+ title: 'Designing Data-Intensive Applications',
+ },
+ me: {
+ id: 'me',
+ } as UserResponse,
+ },
+}
+
+export const LoanedByMe: Story = {
+ args: {
+ book: {
+ authors: ['Martin Kleppmann'],
+ id: '23423432',
+ image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
+ loan: {
+ user: {
+ id: 'me',
+ image: gravatar('sergio@uco.es'),
+ },
+ },
+ title: 'Designing Data-Intensive Applications',
+ } as unknown as BookResponse,
+ me: {
+ id: 'me',
+ } as UserResponse,
+ },
+}
+
+export const Loaned: Story = {
+ args: {
+ book: {
+ authors: ['Martin Kleppmann'],
+ id: '23423432',
+ image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
+ loan: {
+ user: {
+ id: 'not me',
+ image: gravatar('sergio@uco.es'),
+ },
+ },
+ title: 'Designing Data-Intensive Applications',
+ } as unknown as BookResponse,
+ me: {
+ id: 'me',
+ } as UserResponse,
+ },
+}
diff --git a/stories/components/book-grid.stories.ts b/stories/components/book-grid.stories.ts
deleted file mode 100644
index 5911506..0000000
--- a/stories/components/book-grid.stories.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Meta, StoryObj } from '@storybook/react'
-
-import BookGrid from '@/components/book-grid'
-
-const meta = {
- component: BookGrid,
- title: 'Components/BookGrid',
-} satisfies Meta
-
-export default meta
-type Story = StoryObj
-
-export const Basic: Story = {
- args: {
- books: [
- {
- authors: ['Martin Fowler'],
- id: '3',
- image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
- title: 'Refactoring: Improving the Design of Existing Code',
- },
- {
- authors: ['Andrew S. Tanenbaum', 'Andrew S. Tanenbaum'],
- id: '4',
- image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
- title: 'Computer Networks',
- },
- ],
- },
-}
diff --git a/stories/components/book.stories.ts b/stories/components/book.stories.ts
deleted file mode 100644
index bac8d0c..0000000
--- a/stories/components/book.stories.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Meta, StoryObj } from '@storybook/react'
-
-import Book from '@/components/book'
-
-const meta = {
- component: Book,
- title: 'Components/Book',
-} satisfies Meta
-
-export default meta
-type Story = StoryObj
-
-export const Basic: Story = {
- args: {
- book: {
- authors: ['Martin Kleppmann'],
- id: '23423432',
- image: 'https://m.media-amazon.com/images/I/91YfNb49PLL._SL1500_.jpg',
- title: 'Designing Data-Intensive Applications',
- },
- },
-}
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 93509e1..8638c0a 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -10,15 +10,6 @@ const config: Config = {
],
darkMode: 'class',
plugins: [nextui()],
- theme: {
- extend: {
- backgroundImage: {
- 'gradient-conic':
- 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
- 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
- },
- },
- },
}
export default config