1
1
import Image from 'next/image' ;
2
- import { lusitana } from '@/app/ui/fonts' ;
3
2
import Search from '@/app/ui/search' ;
4
3
import {
5
- CustomersTableType ,
6
4
FormattedCustomersTable ,
7
5
} from '@/app/lib/definitions' ;
6
+ import darkTheme from '@/app/lib/dark-theme' ;
8
7
9
8
export default async function CustomersTable ( {
10
9
customers,
@@ -13,20 +12,22 @@ export default async function CustomersTable({
13
12
} ) {
14
13
return (
15
14
< div className = "w-full" >
16
- < h1 className = { `${ lusitana . className } mb-8 text-xl md:text-2xl` } >
17
- Customers
18
- </ h1 >
19
15
< Search placeholder = "Search customers..." />
16
+
20
17
< div className = "mt-6 flow-root" >
21
18
< div className = "overflow-x-auto" >
22
19
< div className = "inline-block min-w-full align-middle" >
23
- < div className = "overflow-hidden rounded-md bg-gray-50 p-2 md:pt-0" >
20
+ < div className = { `
21
+ overflow-hidden rounded-md bg-gray-50 ${ darkTheme . container }
22
+ p-2 md:pt-0
23
+ ` } >
24
24
< div className = "md:hidden" >
25
25
{ customers ?. map ( ( customer ) => (
26
26
< div
27
27
key = { customer . id }
28
- className = "mb-2 w-full rounded-md bg-white p-4"
29
- >
28
+ className = { `
29
+ mb-2 w-full rounded-md bg-white ${ darkTheme . bg } p-4
30
+ ` } >
30
31
< div className = "flex items-center justify-between border-b pb-4" >
31
32
< div >
32
33
< div className = "mb-2 flex items-center" >
@@ -38,7 +39,7 @@ export default async function CustomersTable({
38
39
width = { 28 }
39
40
height = { 28 }
40
41
/>
41
- < p > { customer . name } </ p >
42
+ < p className = { ` ${ darkTheme . title } ` } > { customer . name } </ p >
42
43
</ div >
43
44
</ div >
44
45
< p className = "text-sm text-gray-500" >
@@ -48,22 +49,27 @@ export default async function CustomersTable({
48
49
</ div >
49
50
< div className = "flex w-full items-center justify-between border-b py-5" >
50
51
< div className = "flex w-1/2 flex-col" >
51
- < p className = " text-xs" > Pending</ p >
52
- < p className = " font-medium" > { customer . total_pending } </ p >
52
+ < p className = { ` text-xs ${ darkTheme . title } ` } > Pending</ p >
53
+ < p className = { ` font-medium ${ darkTheme . title } ` } > { customer . total_pending } </ p >
53
54
</ div >
54
55
< div className = "flex w-1/2 flex-col" >
55
- < p className = " text-xs" > Paid</ p >
56
- < p className = " font-medium" > { customer . total_paid } </ p >
56
+ < p className = { ` text-xs ${ darkTheme . title } ` } > Paid</ p >
57
+ < p className = { ` font-medium ${ darkTheme . title } ` } > { customer . total_paid } </ p >
57
58
</ div >
58
59
</ div >
59
- < div className = " pt-4 text-sm" >
60
+ < div className = { ` pt-4 text-sm ${ darkTheme . title } ` } >
60
61
< p > { customer . total_invoices } invoices</ p >
61
62
</ div >
62
63
</ div >
63
64
) ) }
64
65
</ div >
65
- < table className = "hidden min-w-full rounded-md text-gray-900 md:table" >
66
- < thead className = "rounded-md bg-gray-50 text-left text-sm font-normal" >
66
+ < table className = { `
67
+ hidden min-w-full rounded-md text-gray-900 ${ darkTheme . text } md:table
68
+ ` } >
69
+ < thead className = { `
70
+ rounded-md bg-gray-50 ${ darkTheme . container }
71
+ text-left text-sm font-normal
72
+ ` } >
67
73
< tr >
68
74
< th scope = "col" className = "px-4 py-5 font-medium sm:pl-6" >
69
75
Name
@@ -83,10 +89,16 @@ export default async function CustomersTable({
83
89
</ tr >
84
90
</ thead >
85
91
86
- < tbody className = "divide-y divide-gray-200 text-gray-900" >
92
+ < tbody className = { `
93
+ divide-y divide-gray-200 ${ darkTheme . divide }
94
+ text-gray-900 ${ darkTheme . text }
95
+ ` } >
87
96
{ customers . map ( ( customer ) => (
88
97
< tr key = { customer . id } className = "group" >
89
- < td className = "whitespace-nowrap bg-white py-5 pl-4 pr-3 text-sm text-black group-first-of-type:rounded-md group-last-of-type:rounded-md sm:pl-6" >
98
+ < td className = { `
99
+ whitespace-nowrap bg-white ${ darkTheme . bg } py-5 pl-4 pr-3 text-sm
100
+ text-black ${ darkTheme . title } group-first-of-type:rounded-md group-last-of-type:rounded-md sm:pl-6
101
+ ` } >
90
102
< div className = "flex items-center gap-3" >
91
103
< Image
92
104
src = { customer . image_url }
@@ -98,16 +110,24 @@ export default async function CustomersTable({
98
110
< p > { customer . name } </ p >
99
111
</ div >
100
112
</ td >
101
- < td className = "whitespace-nowrap bg-white px-4 py-5 text-sm" >
113
+ < td className = { `
114
+ whitespace-nowrap bg-white ${ darkTheme . bg } px-4 py-5 text-sm
115
+ ` } >
102
116
{ customer . email }
103
117
</ td >
104
- < td className = "whitespace-nowrap bg-white px-4 py-5 text-sm" >
118
+ < td className = { `
119
+ whitespace-nowrap bg-white ${ darkTheme . bg } px-4 py-5 text-sm
120
+ ` } >
105
121
{ customer . total_invoices }
106
122
</ td >
107
- < td className = "whitespace-nowrap bg-white px-4 py-5 text-sm" >
123
+ < td className = { `
124
+ whitespace-nowrap bg-white ${ darkTheme . bg } px-4 py-5 text-sm
125
+ ` } >
108
126
{ customer . total_pending }
109
127
</ td >
110
- < td className = "whitespace-nowrap bg-white px-4 py-5 text-sm group-first-of-type:rounded-md group-last-of-type:rounded-md" >
128
+ < td className = { `whitespace-nowrap bg-white ${ darkTheme . bg } px-4 py-5
129
+ text-sm group-first-of-type:rounded-md group-last-of-type:rounded-md
130
+ ` } >
111
131
{ customer . total_paid }
112
132
</ td >
113
133
</ tr >
0 commit comments