@@ -76,20 +76,6 @@ const BaseTable = <T extends TableItem>({
76
76
renderItem,
77
77
placeholder,
78
78
} : BaseTableProps < T > ) : JSX . Element => {
79
- const colWidth = useMemo ( ( ) => {
80
- const width = Math . floor ( 100 / headers . length ) ;
81
- switch ( width ) {
82
- case 25 :
83
- return "w-1/4" ;
84
- case 33 :
85
- return "w-1/3" ;
86
- case 50 :
87
- return "w-1/2" ;
88
- default :
89
- return "grow" ;
90
- }
91
- } , [ headers . length ] ) ;
92
-
93
79
const filteredItems = useMemo ( ( ) => {
94
80
const defaultFilterMethod = ( filterValue : string ) => ( item : T ) =>
95
81
! filterValue ?. trim ( ) ||
@@ -241,6 +227,9 @@ const BaseTable = <T extends TableItem>({
241
227
}
242
228
243
229
case "propName" :
230
+ let description = ! item . description
231
+ ? "No description available"
232
+ : item . description ;
244
233
return (
245
234
< div
246
235
className = "flex h-full w-full items-center justify-center px-1"
@@ -255,7 +244,7 @@ const BaseTable = <T extends TableItem>({
255
244
< div className = "items-center justify-center px-1" >
256
245
< Icon
257
246
id = "info"
258
- html = { `Property description: ${ item . description } ` }
247
+ html = { `Property description: ${ description } ` }
259
248
IconComponent = { Info }
260
249
/>
261
250
</ div >
@@ -388,30 +377,30 @@ const BaseTable = <T extends TableItem>({
388
377
return (
389
378
< BasePagination items = { orderedItems } itemsPerPage = { itemsPerPage } >
390
379
{ ( { items : paginatedItems } ) => (
391
- < div className = { `w-full ${ className } ` } >
392
- { /* Headers */ }
393
- < div className = "flex" >
394
- { headers . map ( ( header , index ) => (
395
- < div
396
- key = { `header- ${ header . key } ` }
397
- className = { `text-elevation-0-1 my-2.5 flex h-auto items-center text-center text-sm font-bold text-white ${
398
- index === 0
399
- ? "justify-start pl-5"
400
- : index === headers . length - 1
401
- ? "justify-end pr-5"
402
- : "justify-center"
403
- } `}
404
- style = { {
405
- width : ` ${ 100 / headers . length } %` ,
406
- wordWrap : "break-word" ,
407
- wordBreak : "break-word" ,
408
- whiteSpace : "normal" ,
409
- } }
410
- >
411
- < div > { header . text } </ div >
412
- </ div >
413
- ) ) }
414
- </ div >
380
+ < div className = "relative overflow-x-auto" >
381
+ < div className = { `inline-block min-w-full ${ className } ` } >
382
+ { /* Table Container */ }
383
+ < div
384
+ className = "grid"
385
+ style = { {
386
+ gridTemplateColumns : `repeat( ${ headers . length } , minmax(150px, 1fr))` ,
387
+ } }
388
+ >
389
+ { /* Headers */ }
390
+ { headers . map ( ( header , index ) => (
391
+ < div
392
+ key = { `header- ${ header . key } `}
393
+ className = { `text-elevation-0-1 my-2.5 flex items-center justify-center text-sm font-bold text-white $ {
394
+ index === 0
395
+ ? "pl-5"
396
+ : index === headers . length - 1
397
+ ? "pr-5"
398
+ : "px-5"
399
+ } ` }
400
+ >
401
+ { header . text }
402
+ </ div >
403
+ ) ) }
415
404
416
405
{ /* Rows */ }
417
406
{ paginatedItems . length > 0 ? (
0 commit comments