1+ import Image from 'next/image' ;
2+ import Link from 'next/link' ;
3+ import { TrendingDown , TrendingUp } from 'lucide-react' ;
4+
15import { DataTable } from '@/components/DataTable' ;
26import { getTrendingCoins } from '@/lib/coingecko.actions' ;
37import { cn , formatPercentage , formatPrice } from '@/lib/utils' ;
4- import { TrendingDown , TrendingUp } from 'lucide-react' ;
5- import Image from 'next/image' ;
6- import Link from 'next/link' ;
78
89export const TrendingCoins = async ( ) => {
910 const trendingCoins = ( await getTrendingCoins ( ) ) as TrendingCoin [ ] ;
11+
1012 const columns = [
1113 {
1214 header : 'Name' ,
13- cellClassName : 'font-bold ' ,
15+ cellClassName : 'name-cell ' ,
1416 cell : ( coin : TrendingCoin ) => {
1517 const item = coin . item ;
1618
1719 return (
18- < Link href = { `/coins/${ item . id } ` } className = 'coin-link' >
19- < Image
20- src = { item . large }
21- alt = { item . name }
22- width = { 36 }
23- height = { 36 }
24- className = 'coin-image'
25- />
26- < div >
27- < p className = 'text-sm md:text-base' > { item . name } </ p >
28- </ div >
20+ < Link href = { `/coins/${ item . id } ` } >
21+ < Image src = { item . large } alt = { item . name } width = { 36 } height = { 36 } />
22+ < p > { item . name } </ p >
2923 </ Link >
3024 ) ;
3125 } ,
3226 } ,
3327 {
3428 header : '24h Change' ,
35- cellClassName : 'table -cell-change ' ,
29+ cellClassName : 'change -cell' ,
3630 cell : ( coin : TrendingCoin ) => {
3731 const item = coin . item ;
3832 const isTrendingUp = item . data . price_change_percentage_24h . usd > 0 ;
3933
4034 return (
4135 < div
4236 className = { cn (
43- 'price-change-indicator ' ,
37+ 'price-change' ,
4438 isTrendingUp ? 'text-green-500' : 'text-red-500'
4539 ) }
4640 >
@@ -56,26 +50,24 @@ export const TrendingCoins = async () => {
5650 } ,
5751 {
5852 header : 'Price' ,
59- cellClassName : 'table -cell-price ' ,
53+ cellClassName : 'price -cell' ,
6054 cell : ( coin : TrendingCoin ) => {
6155 return formatPrice ( coin . item . data . price ) ;
6256 } ,
6357 } ,
6458 ] ;
6559
6660 return (
67- < div className = 'top-movers-container' >
68- < h4 className = 'section-title px-5' > Trending Coins</ h4 >
69- < div className = 'table-scrollbar-container custom-scrollbar' >
70- < DataTable
71- columns = { columns }
72- data = { trendingCoins . slice ( 0 , 6 ) }
73- rowKey = { ( _ , index ) => index }
74- headerClassName = 'table-header-cell'
75- headerRowClassName = 'hover:bg-transparent'
76- bodyRowClassName = 'table-row-hover'
77- />
78- </ div >
61+ < div id = 'trending-coins' >
62+ < h4 > Trending Coins</ h4 >
63+
64+ < DataTable
65+ tableClassName = 'trending-coins-table'
66+ columns = { columns }
67+ data = { trendingCoins . slice ( 0 , 6 ) }
68+ rowKey = { ( _ , index ) => index }
69+ bodyRowClassName = 'body-row'
70+ />
7971 </ div >
8072 ) ;
8173} ;
0 commit comments