Skip to content

Commit 17ef11b

Browse files
committed
Added share button
1 parent 6f88f9c commit 17ef11b

File tree

4 files changed

+42
-33
lines changed

4 files changed

+42
-33
lines changed

app/routes/app.tsx

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import { TwitterIcon, TwitterShareButton } from "next-share";
12
import { LoaderFunction, redirect, useLoaderData, useTransition } from "remix";
2-
import { ChartProvider, XAxis, BarSeries, YAxis, Tooltip } from "rough-charts";
3-
import { mockResponse } from "~/mocks/mock-response";
3+
import { BarSeries, ChartProvider, Tooltip, XAxis, YAxis } from "rough-charts";
44
import { Article } from "~/types/articleData";
55
import { ArticleProcessedData } from "~/types/articleProcessedData";
66
import { cookie } from "~/utils/cookie.server";
77
import {
8-
processArticlesStats,
98
articlesMapByMonth,
109
findMonthWithHeighestArticles,
10+
processArticlesStats,
1111
} from "~/utils/processArticles";
1212

1313
export const loader: LoaderFunction = async ({ request, params }) => {
@@ -109,6 +109,18 @@ export default function AppRoute() {
109109
</ChartProvider>
110110
</div>
111111
</div>
112+
113+
<div className="my-2 flex flex-row-reverse">
114+
<div className="prose ml-4">Share it if you like it :D </div>
115+
<TwitterShareButton
116+
url={"https://devto-wrapped.netlify.app/"}
117+
title={
118+
"Generate a report of your articles in 2021 and share it with your friends"
119+
}
120+
>
121+
<TwitterIcon size={32} round />
122+
</TwitterShareButton>
123+
</div>
112124
</div>
113125
);
114126
}

app/tailwind.css

+21-30
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,18 @@ select {
11121112
margin-top: 1rem;
11131113
}
11141114

1115+
.mr-8 {
1116+
margin-right: 2rem;
1117+
}
1118+
1119+
.mr-4 {
1120+
margin-right: 1rem;
1121+
}
1122+
1123+
.ml-4 {
1124+
margin-left: 1rem;
1125+
}
1126+
11151127
.block {
11161128
display: block;
11171129
}
@@ -1196,6 +1208,10 @@ select {
11961208
flex-direction: row;
11971209
}
11981210

1211+
.flex-row-reverse {
1212+
flex-direction: row-reverse;
1213+
}
1214+
11991215
.flex-col {
12001216
flex-direction: column;
12011217
}
@@ -1262,11 +1278,6 @@ select {
12621278
border-color: rgb(14 165 233 / var(--tw-border-opacity));
12631279
}
12641280

1265-
.border-sky-50 {
1266-
--tw-border-opacity: 1;
1267-
border-color: rgb(240 249 255 / var(--tw-border-opacity));
1268-
}
1269-
12701281
.bg-lime-50 {
12711282
--tw-bg-opacity: 1;
12721283
background-color: rgb(247 254 231 / var(--tw-bg-opacity));
@@ -1297,11 +1308,6 @@ select {
12971308
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
12981309
}
12991310

1300-
.bg-sky-300 {
1301-
--tw-bg-opacity: 1;
1302-
background-color: rgb(125 211 252 / var(--tw-bg-opacity));
1303-
}
1304-
13051311
.p-8 {
13061312
padding: 2rem;
13071313
}
@@ -1401,6 +1407,11 @@ select {
14011407
color: rgb(239 68 68 / var(--tw-text-opacity));
14021408
}
14031409

1410+
.text-sky-500 {
1411+
--tw-text-opacity: 1;
1412+
color: rgb(14 165 233 / var(--tw-text-opacity));
1413+
}
1414+
14041415
.text-slate-200 {
14051416
--tw-text-opacity: 1;
14061417
color: rgb(226 232 240 / var(--tw-text-opacity));
@@ -1411,16 +1422,6 @@ select {
14111422
color: rgb(56 189 248 / var(--tw-text-opacity));
14121423
}
14131424

1414-
.text-blue-600 {
1415-
--tw-text-opacity: 1;
1416-
color: rgb(37 99 235 / var(--tw-text-opacity));
1417-
}
1418-
1419-
.text-sky-500 {
1420-
--tw-text-opacity: 1;
1421-
color: rgb(14 165 233 / var(--tw-text-opacity));
1422-
}
1423-
14241425
.underline {
14251426
-webkit-text-decoration-line: underline;
14261427
text-decoration-line: underline;
@@ -1490,11 +1491,6 @@ select {
14901491
transition-duration: 150ms;
14911492
}
14921493

1493-
.visited\:text-purple-600:visited {
1494-
--tw-text-opacity: 1;
1495-
color: rgb(147 51 234 / var(--tw-text-opacity));
1496-
}
1497-
14981494
.visited\:text-sky-600:visited {
14991495
--tw-text-opacity: 1;
15001496
color: rgb(2 132 199 / var(--tw-text-opacity));
@@ -1505,11 +1501,6 @@ select {
15051501
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
15061502
}
15071503

1508-
.hover\:text-blue-800:hover {
1509-
--tw-text-opacity: 1;
1510-
color: rgb(30 64 175 / var(--tw-text-opacity));
1511-
}
1512-
15131504
.hover\:text-sky-500:hover {
15141505
--tw-text-opacity: 1;
15151506
color: rgb(14 165 233 / var(--tw-text-opacity));

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@remix-run/react": "^1.1.1",
1717
"@tailwindcss/forms": "^0.4.0",
1818
"@tailwindcss/typography": "^0.5.0",
19+
"next-share": "^0.12.2",
1920
"react": "^17.0.2",
2021
"react-dom": "^17.0.2",
2122
"remix": "^1.1.1",

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,11 @@ neo-async@^2.6.2:
28142814
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
28152815
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
28162816

2817+
next-share@^0.12.2:
2818+
version "0.12.2"
2819+
resolved "https://registry.yarnpkg.com/next-share/-/next-share-0.12.2.tgz#209e20c04d4e3e1e93f0b3d731142347bae9648e"
2820+
integrity sha512-Eklbhcvyx51HZAvdDUFmI3YowamiVgoVpY7xOylENDttG0bdFxlF9iol9g6zoU0fLSAhDuZkdEurNcFFKVKu9Q==
2821+
28172822
next-tick@~1.0.0:
28182823
version "1.0.0"
28192824
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"

0 commit comments

Comments
 (0)