From f0a9ed8ad427428bf07c886e10187777ede21f3d Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 23 Mar 2022 13:41:30 -0400 Subject: [PATCH 1/2] Fix prop warnings --- app/soapbox/components/permalink.js | Bin 1012 -> 1145 bytes app/soapbox/components/status_list.js | Bin 7312 -> 7302 bytes .../compose/components/privacy_dropdown.js | Bin 9083 -> 9029 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/app/soapbox/components/permalink.js b/app/soapbox/components/permalink.js index 5bae087ac13db7d0e57a3362e6f3a0632ab6ee5b..b94ef16482459e547d302a0ab3c176f4748d841e 100644 GIT binary patch delta 148 zcmeyu{*z7_ON(YoGQwvI*b25{&brkgU^zutGQi~=RF~@UO!+HEH FSpb1O6oUW& diff --git a/app/soapbox/components/status_list.js b/app/soapbox/components/status_list.js index 65bbdba5281701fe9f49aa75dfbc5f68af5b3298..c8bcbb217bad98fd29f1d784776586880e877bc0 100644 GIT binary patch delta 30 lcmbPW*=D)HL|QN)CowrSBR?l4wJ5kGv81$kv%j<>BLJ(H3f}+# delta 40 vcmZp(oM5@ZL|R%yQ^D3w!6qOlF*!9OKPM%%D7YlCq_kK;-)^(3v?C(`1ON=Q diff --git a/app/soapbox/features/compose/components/privacy_dropdown.js b/app/soapbox/features/compose/components/privacy_dropdown.js index 415789ba50bd9417231e9e342ee6bd33bca3a647..23111ab1b6adc4430e665ec264c3f3c8262d1e99 100644 GIT binary patch delta 12 TcmezEcGPV{vf}2MijNopDgXu1 delta 53 vcmX@=_S Date: Wed, 23 Mar 2022 13:50:12 -0400 Subject: [PATCH 2/2] 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;