From 95a5ca2115f47b99a219e266e7b0c2f636d9e4d1 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 23 Mar 2022 13:50:12 -0400 Subject: [PATCH] Convert Permalink to TSX --- app/soapbox/components/permalink.js | Bin 1145 -> 0 bytes app/soapbox/components/permalink.tsx | 37 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) delete mode 100644 app/soapbox/components/permalink.js create mode 100644 app/soapbox/components/permalink.tsx diff --git a/app/soapbox/components/permalink.js b/app/soapbox/components/permalink.js deleted file mode 100644 index b94ef16482459e547d302a0ab3c176f4748d841e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1145 zcma)5U2oGc6n*cnI7nzoMH_hD=7BUGnD|gN_RieowlPiYVBf&1EdL$bNoh1FTJjS6 zp4@ZpIku`BV;L)Jn!9~N4jXG~B#mD$Icy{sGc{mtN#;D(ZTLQxI{Z>x-kO%lqMu@x zHf}BpQ+xP~9wJ>q8`)NjcgNpmc_p30ifk<_rFWnQCS5p0+HBQYx;9>jCe7$(Gr+NA zl_N+Uqzk_f|HMvTWKHMCxiZIA>Fpu{N=uu+YngJl^rKaliUG#v8KAsWRbfd_q1qHQ zv@rTcdrxv|__|X0Zi?EpIv@2Y$HwlbMYH}+IgdINS0`sFq~4M@*;V_m#5Y=#{c!jB z)4zN5J_4YWx~M4XfdD~VjmD`BQZALtf~PKfDjsKN_)j^V&&NIh`4;rkNA-S4I-Orc z=K)LHT0N}#paytC>jeZi0vl!Pmf2_sA@C;byhtg_*;XHEkH<$3sEMUtJd1lGek947 z)|Jzl*^EkiFD>fx*%oBe!)&?H&L2R8Gqk`Veg74XZ#Z-daL8+c6Uq4dAtpA)L=Ltf z9bLMVU}?9+BKfwiq~0ZwP;`N|htV-T(Zz`-dG@DRMR!6@Kgjj1g6jS_hv@E`!)1Kg n{TUB$k@)x35r}gnNq^s8joN|kU`sGDJeRNKP>tq#Tl?8>LJxY; diff --git a/app/soapbox/components/permalink.tsx b/app/soapbox/components/permalink.tsx new file mode 100644 index 0000000000..db68811e5b --- /dev/null +++ b/app/soapbox/components/permalink.tsx @@ -0,0 +1,37 @@ +import * as React from 'react'; +import { useHistory } from 'react-router-dom'; + +interface IPermaLink extends Pick, 'dangerouslySetInnerHTML'> { + className?: string, + href: string, + title?: string, + to: string, +} + +const Permalink: React.FC = (props) => { + const history = useHistory(); + + const { className, href, title, to, children, ...filteredProps } = props; + + const handleClick = (event: React.MouseEvent) => { + if (event.button === 0 && !(event.ctrlKey || event.metaKey)) { + event.preventDefault(); + history.push(to); + } + }; + + return ( + + {children} + + ); +}; + +export default Permalink;