Use our own Tweet button instead of loading Twitter script
This commit is contained in:
parent
596c6fe33d
commit
6d97b82aee
|
@ -3,40 +3,20 @@ export function TweetButton(props: { tweetText?: string }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
className="twitter-share-button"
|
className="btn btn-sm normal-case self-start border-none"
|
||||||
|
style={{ backgroundColor: '#1da1f2' }}
|
||||||
href={`https://twitter.com/intent/tweet?text=${encodeURIComponent(
|
href={`https://twitter.com/intent/tweet?text=${encodeURIComponent(
|
||||||
tweetText ?? ''
|
tweetText ?? ''
|
||||||
)}`}
|
)}`}
|
||||||
data-size="large"
|
target="_blank"
|
||||||
>
|
>
|
||||||
|
<img
|
||||||
|
className="mr-2"
|
||||||
|
src={'/twitter-icon-white.svg'}
|
||||||
|
width={18}
|
||||||
|
height={18}
|
||||||
|
/>
|
||||||
Tweet
|
Tweet
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TwitterScript() {
|
|
||||||
return (
|
|
||||||
<script
|
|
||||||
dangerouslySetInnerHTML={{
|
|
||||||
__html: `
|
|
||||||
window.twttr = (function(d, s, id) {
|
|
||||||
var js, fjs = d.getElementsByTagName(s)[0],
|
|
||||||
t = window.twttr || {};
|
|
||||||
if (d.getElementById(id)) return t;
|
|
||||||
js = d.createElement(s);
|
|
||||||
js.id = id;
|
|
||||||
js.src = "https://platform.twitter.com/widgets.js";
|
|
||||||
fjs.parentNode.insertBefore(js, fjs);
|
|
||||||
|
|
||||||
t._e = [];
|
|
||||||
t.ready = function(f) {
|
|
||||||
t._e.push(f);
|
|
||||||
};
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}(document, "script", "twitter-wjs"));
|
|
||||||
`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Html, Head, Main, NextScript } from 'next/document'
|
import { Html, Head, Main, NextScript } from 'next/document'
|
||||||
import { TwitterScript } from '../components/tweet-button'
|
|
||||||
|
|
||||||
export default function Document() {
|
export default function Document() {
|
||||||
return (
|
return (
|
||||||
|
@ -32,8 +31,6 @@ export default function Document() {
|
||||||
`,
|
`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TwitterScript />
|
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<body className="min-h-screen font-readex-pro bg-base-200">
|
<body className="min-h-screen font-readex-pro bg-base-200">
|
||||||
|
|
16
web/public/twitter-icon-white.svg
Normal file
16
web/public/twitter-icon-white.svg
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 24.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 248 204" style="enable-background:new 0 0 248 204;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#FFFFFF;}
|
||||||
|
</style>
|
||||||
|
<g id="Logo_1_">
|
||||||
|
<path id="white_background" class="st0" d="M221.95,51.29c0.15,2.17,0.15,4.34,0.15,6.53c0,66.73-50.8,143.69-143.69,143.69v-0.04
|
||||||
|
C50.97,201.51,24.1,193.65,1,178.83c3.99,0.48,8,0.72,12.02,0.73c22.74,0.02,44.83-7.61,62.72-21.66
|
||||||
|
c-21.61-0.41-40.56-14.5-47.18-35.07c7.57,1.46,15.37,1.16,22.8-0.87C27.8,117.2,10.85,96.5,10.85,72.46c0-0.22,0-0.43,0-0.64
|
||||||
|
c7.02,3.91,14.88,6.08,22.92,6.32C11.58,63.31,4.74,33.79,18.14,10.71c25.64,31.55,63.47,50.73,104.08,52.76
|
||||||
|
c-4.07-17.54,1.49-35.92,14.61-48.25c20.34-19.12,52.33-18.14,71.45,2.19c11.31-2.23,22.15-6.38,32.07-12.26
|
||||||
|
c-3.77,11.69-11.66,21.62-22.2,27.93c10.01-1.18,19.79-3.86,29-7.95C240.37,35.29,231.83,44.14,221.95,51.29z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user