1
1
import { LoaderFunction , useLoaderData } from "remix" ;
2
- import { ChartProvider , LineSeries , Tooltip , XAxis , YAxis } from "rough-charts" ;
2
+ import { BarSeries , ChartProvider , Tooltip , XAxis , YAxis } from "rough-charts" ;
3
3
import { ArticleProcessedData } from "~/types/articleProcessedData" ;
4
4
import { mockResponse } from "../../mocks/mock-response" ;
5
5
import { Article } from "../../types/articleData" ;
@@ -35,43 +35,36 @@ export default function JokeRoute() {
35
35
36
36
return (
37
37
< div >
38
- < h1 className = "text-center py-4 text-2xl mb-4 font-semibold" >
38
+ < h1 className = "text-center py-4 underline decoration-cyan-300 text-2xl mb-4 font-semibold" >
39
39
Dev.to Wrapped 2021
40
40
</ h1 >
41
- < div className = "text-xl" >
42
- { `You have written a total of ${ stats . totalArticles } articles in 2021` }
43
- </ div >
44
- < div className = "text-xl " >
45
- { `You have written more articles in the month of ${ articleProcessedData . monthHighArticles } ` }
41
+ < div className = "border-solid rounded-lg my-8 p-8 shadow-lg shadow-lime-100/50 bg-lime-100 flex flex-row justify-between" >
42
+ < div className = "text-xl underline decoration-sky-500 decoration-2" >
43
+ { `You have written a total of ${ stats . totalArticles } articles in 2021` }
44
+ </ div >
45
+ < div className = "text-xl underline decoration-pink-500 decoration-2" >
46
+ { `You have written more articles in the month of ${ articleProcessedData . monthHighArticles } ` }
47
+ </ div >
46
48
</ div >
49
+
47
50
< div className = "flex flex-row justify-between" >
48
- < p > Total Views: { stats . totalViews } </ p >
49
- < p > Total Reactions: { stats . totalReactions } </ p >
50
- < p > Total Comments: { stats . totalComments } </ p >
51
- < p > Total Reading Time: { stats . totalReadingTime } </ p >
51
+ < StatsContainer title = { `Total Views: ${ stats . totalViews } ` } />
52
+ < StatsContainer title = { `Total Comments: ${ stats . totalComments } ` } />
53
+ < StatsContainer title = { `Total Reactions: ${ stats . totalReactions } ` } />
54
+ < StatsContainer title = { `Total Articles: ${ stats . totalArticles } ` } />
55
+ < StatsContainer
56
+ title = { `Total Reading time: ${ stats . totalReadingTime } min` }
57
+ />
52
58
</ div >
53
59
54
60
< div className = "my-2 flex flex-col" >
55
61
< div className = "my-4" >
56
62
< ChartProvider
57
63
data = { articleProcessedData . monthWiseGraphData }
58
- height = { 400 }
59
- >
60
- < XAxis dataKey = "month" />
61
- < LineSeries dataKey = "articles" />
62
- < YAxis dataKey = "articles" format = { ( count ) => `${ count } ` } />
63
- < Tooltip >
64
- { ( { month, articles } ) => `Articles in ${ month } : ${ articles } ` }
65
- </ Tooltip >
66
- </ ChartProvider >
67
- </ div >
68
- < div className = "my-4" >
69
- < ChartProvider
70
- data = { articleProcessedData . monthWiseGraphData }
71
- height = { 400 }
64
+ height = { 300 }
72
65
>
73
66
< XAxis dataKey = "month" />
74
- < LineSeries dataKey = "articles" />
67
+ < BarSeries dataKey = "articles" />
75
68
< YAxis dataKey = "articles" format = { ( count ) => `${ count } ` } />
76
69
< Tooltip >
77
70
{ ( { month, articles } ) => `Articles in ${ month } : ${ articles } ` }
@@ -82,3 +75,13 @@ export default function JokeRoute() {
82
75
</ div >
83
76
) ;
84
77
}
78
+ interface StatsContainerProps {
79
+ title : string ;
80
+ }
81
+ const StatsContainer : React . FC < StatsContainerProps > = ( { title } ) => {
82
+ return (
83
+ < div className = "border-solid rounded-lg bg-lime-200 shadow-lime-200/50 p-8" >
84
+ { title }
85
+ </ div >
86
+ ) ;
87
+ } ;
0 commit comments