Added kofi support me
This commit is contained in:
parent
3fb1c6434a
commit
56f871f603
8
global.d.ts
vendored
8
global.d.ts
vendored
@ -3,4 +3,10 @@ declare namespace NodeJS {
|
||||
NEXT_PUBLIC_API_URL: string;
|
||||
STRAPI_API_TOKEN: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
declare global {
|
||||
interface Window {
|
||||
kofiWidgetOverlay: any;
|
||||
}
|
||||
}
|
||||
export {};
|
@ -5,6 +5,7 @@ import "tailwindcss/tailwind.css";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import NightModeToggle from "@/components/NightModeToggle";
|
||||
import Navbar from "@/components/NavigationBar";
|
||||
import KofiWidget from "@/components/KofiWidget";
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const [isDarkMode, setIsDarkMode] = useState(false);
|
||||
@ -49,8 +50,10 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
|
||||
</head>
|
||||
<body className="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen">
|
||||
<KofiWidget />
|
||||
<Navbar />
|
||||
<main className="relative">{children}</main>
|
||||
<div className="fixed bottom-4 right-4">
|
||||
|
31
src/components/KofiWidget.tsx
Normal file
31
src/components/KofiWidget.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
"use client"
|
||||
import { useEffect } from 'react';
|
||||
|
||||
const KofiWidget = () => {
|
||||
useEffect(() => {
|
||||
// Dynamically create and append the script
|
||||
const script = document.createElement('script');
|
||||
script.src = 'https://storage.ko-fi.com/cdn/scripts/overlay-widget.js';
|
||||
script.async = true;
|
||||
script.onload = () => {
|
||||
if (typeof window !== 'undefined' && window.kofiWidgetOverlay) {
|
||||
window.kofiWidgetOverlay.draw('nulltranslationgroup', {
|
||||
'type': 'floating-chat',
|
||||
'floating-chat.donateButton.text': 'Support me',
|
||||
'floating-chat.donateButton.background-color': '#00b9fe',
|
||||
'floating-chat.donateButton.text-color': '#fff',
|
||||
});
|
||||
}
|
||||
};
|
||||
document.body.appendChild(script);
|
||||
|
||||
return () => {
|
||||
// Clean up the script when the component unmounts
|
||||
document.body.removeChild(script);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return null; // No visible JSX; the widget is a floating overlay
|
||||
};
|
||||
|
||||
export default KofiWidget;
|
Loading…
Reference in New Issue
Block a user