Skip to content

Commit 4bde74e

Browse files
committed
fix: build fail
1 parent ed6ea33 commit 4bde74e

File tree

5 files changed

+103
-94
lines changed

5 files changed

+103
-94
lines changed

components/borrows/BtnReturnBorrow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import { Borrow } from '@/lib/types/borrow'
44
import { useTransition, useState } from 'react'
5-
import { Button, ButtonProps } from '../ui/button'
5+
import { Button } from '../ui/button'
66
import { Lock, Unlock, Loader } from 'lucide-react'
77
import { returnBorrowAction } from '@/lib/actions/return-borrow'
88
import { formatDate } from '@/lib/utils'
99
import { toast } from '../hooks/use-toast'
1010

1111
export const BtnReturnBook: React.FC<
12-
ButtonProps & {
12+
React.ComponentProps<typeof Button> & {
1313
borrow: Borrow
1414
}
1515
> = ({ borrow, ...props }) => {

components/borrows/BtnUndoReturn.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import { Borrow } from '@/lib/types/borrow'
44
import { useTransition, useState } from 'react'
5-
import { Button, ButtonProps } from '../ui/button'
5+
import { Button } from '../ui/button'
66
import { Lock, Unlock, Loader } from 'lucide-react'
77
import { undoReturnAction } from '@/lib/actions/undo-return'
88
import { toast } from '../hooks/use-toast'
99

1010
export const BtnUndoReturn: React.FC<
11-
ButtonProps & {
11+
React.ComponentProps<typeof Button> & {
1212
borrow: Borrow
1313
}
1414
> = ({ borrow, ...props }) => {

components/dashboard/MonthlyRevenueChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function MonthlyRevenueChart({ data }: { data: Analysis['revenue'] }) {
7272
tickLine={false}
7373
axisLine={false}
7474
tickMargin={8}
75-
tickFormatter={formatDate}
75+
tickFormatter={(value) => formatDate(value)}
7676
/>
7777
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
7878
<defs>

components/dashboard/MontlyBorrowChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function MontlyBorrowChart({ data }: { data: Analysis['borrowing'] }) {
6868
tickLine={false}
6969
axisLine={false}
7070
tickMargin={8}
71-
tickFormatter={formatDate}
71+
tickFormatter={(value) => formatDate(value)}
7272
/>
7373
<ChartTooltip
7474
cursor={false}

components/ui/pagination.tsx

Lines changed: 97 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,127 @@
11
import * as React from 'react'
2-
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react'
2+
import {
3+
ChevronLeftIcon,
4+
ChevronRightIcon,
5+
MoreHorizontalIcon,
6+
} from 'lucide-react'
37

48
import { cn } from '@/lib/utils'
5-
import { ButtonProps, buttonVariants } from '@/components/ui/button'
6-
import Link from 'next/link'
9+
import { Button, buttonVariants } from '@/components/ui/button'
710

8-
const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => (
9-
<nav
10-
role="navigation"
11-
aria-label="pagination"
12-
className={cn('mx-auto flex w-full justify-center', className)}
13-
{...props}
14-
/>
15-
)
16-
Pagination.displayName = 'Pagination'
11+
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
12+
return (
13+
<nav
14+
role="navigation"
15+
aria-label="pagination"
16+
data-slot="pagination"
17+
className={cn('mx-auto flex w-full justify-center', className)}
18+
{...props}
19+
/>
20+
)
21+
}
1722

18-
const PaginationContent = React.forwardRef<
19-
HTMLUListElement,
20-
React.ComponentProps<'ul'>
21-
>(({ className, ...props }, ref) => (
22-
<ul
23-
ref={ref}
24-
className={cn('flex flex-row items-center gap-1', className)}
25-
{...props}
26-
/>
27-
))
28-
PaginationContent.displayName = 'PaginationContent'
23+
function PaginationContent({
24+
className,
25+
...props
26+
}: React.ComponentProps<'ul'>) {
27+
return (
28+
<ul
29+
data-slot="pagination-content"
30+
className={cn('flex flex-row items-center gap-1', className)}
31+
{...props}
32+
/>
33+
)
34+
}
2935

30-
const PaginationItem = React.forwardRef<
31-
HTMLLIElement,
32-
React.ComponentProps<'li'>
33-
>(({ className, ...props }, ref) => (
34-
<li ref={ref} className={cn('', className)} {...props} />
35-
))
36-
PaginationItem.displayName = 'PaginationItem'
36+
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
37+
return <li data-slot="pagination-item" {...props} />
38+
}
3739

3840
type PaginationLinkProps = {
3941
isActive?: boolean
40-
} & Pick<ButtonProps, 'size'> &
41-
React.ComponentProps<typeof Link>
42+
} & Pick<React.ComponentProps<typeof Button>, 'size'> &
43+
React.ComponentProps<'a'>
4244

43-
const PaginationLink = ({
45+
function PaginationLink({
4446
className,
4547
isActive,
4648
size = 'icon',
4749
...props
48-
}: PaginationLinkProps) => (
49-
<Link
50-
aria-current={isActive ? 'page' : undefined}
51-
className={cn(
52-
buttonVariants({
53-
variant: isActive ? 'outline' : 'ghost',
54-
size,
55-
}),
56-
className
57-
)}
58-
{...props}
59-
/>
60-
)
61-
PaginationLink.displayName = 'PaginationLink'
50+
}: PaginationLinkProps) {
51+
return (
52+
<a
53+
aria-current={isActive ? 'page' : undefined}
54+
data-slot="pagination-link"
55+
data-active={isActive}
56+
className={cn(
57+
buttonVariants({
58+
variant: isActive ? 'outline' : 'ghost',
59+
size,
60+
}),
61+
className
62+
)}
63+
{...props}
64+
/>
65+
)
66+
}
6267

63-
const PaginationPrevious = ({
68+
function PaginationPrevious({
6469
className,
6570
...props
66-
}: React.ComponentProps<typeof PaginationLink>) => (
67-
<PaginationLink
68-
aria-label="Go to previous page"
69-
size="default"
70-
className={cn('gap-1 pl-2.5', className)}
71-
{...props}
72-
>
73-
<ChevronLeft className="size-4" />
74-
<span>Previous</span>
75-
</PaginationLink>
76-
)
77-
PaginationPrevious.displayName = 'PaginationPrevious'
71+
}: React.ComponentProps<typeof PaginationLink>) {
72+
return (
73+
<PaginationLink
74+
aria-label="Go to previous page"
75+
size="default"
76+
className={cn('gap-1 px-2.5 sm:pl-2.5', className)}
77+
{...props}
78+
>
79+
<ChevronLeftIcon />
80+
<span className="hidden sm:block">Previous</span>
81+
</PaginationLink>
82+
)
83+
}
7884

79-
const PaginationNext = ({
85+
function PaginationNext({
8086
className,
8187
...props
82-
}: React.ComponentProps<typeof PaginationLink>) => (
83-
<PaginationLink
84-
aria-label="Go to next page"
85-
size="default"
86-
className={cn('gap-1 pr-2.5', className)}
87-
{...props}
88-
>
89-
<span>Next</span>
90-
<ChevronRight className="size-4" />
91-
</PaginationLink>
92-
)
93-
PaginationNext.displayName = 'PaginationNext'
88+
}: React.ComponentProps<typeof PaginationLink>) {
89+
return (
90+
<PaginationLink
91+
aria-label="Go to next page"
92+
size="default"
93+
className={cn('gap-1 px-2.5 sm:pr-2.5', className)}
94+
{...props}
95+
>
96+
<span className="hidden sm:block">Next</span>
97+
<ChevronRightIcon />
98+
</PaginationLink>
99+
)
100+
}
94101

95-
const PaginationEllipsis = ({
102+
function PaginationEllipsis({
96103
className,
97104
...props
98-
}: React.ComponentProps<'span'>) => (
99-
<span
100-
aria-hidden
101-
className={cn('flex size-9 items-center justify-center', className)}
102-
{...props}
103-
>
104-
<MoreHorizontal className="size-4" />
105-
<span className="sr-only">More pages</span>
106-
</span>
107-
)
108-
PaginationEllipsis.displayName = 'PaginationEllipsis'
105+
}: React.ComponentProps<'span'>) {
106+
return (
107+
<span
108+
aria-hidden
109+
data-slot="pagination-ellipsis"
110+
className={cn('flex size-9 items-center justify-center', className)}
111+
{...props}
112+
>
113+
<MoreHorizontalIcon className="size-4" />
114+
<span className="sr-only">More pages</span>
115+
</span>
116+
)
117+
}
109118

110119
export {
111120
Pagination,
112121
PaginationContent,
113-
PaginationEllipsis,
114-
PaginationItem,
115122
PaginationLink,
116-
PaginationNext,
123+
PaginationItem,
117124
PaginationPrevious,
125+
PaginationNext,
126+
PaginationEllipsis,
118127
}

0 commit comments

Comments
 (0)