From beae3366667b54b83e20f7e8d532f694c81bc5d0 Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Sun, 14 Jan 2024 11:42:32 -0500 Subject: Add donation button (closes #40) --- src/components/donation-button.tsx | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/components/donation-button.tsx (limited to 'src/components') diff --git a/src/components/donation-button.tsx b/src/components/donation-button.tsx new file mode 100644 index 0000000..34fcfb1 --- /dev/null +++ b/src/components/donation-button.tsx @@ -0,0 +1,123 @@ +'use client' +import { Button } from '@/components/ui/button' +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from '@/components/ui/dialog' +import { + Drawer, + DrawerContent, + DrawerDescription, + DrawerHeader, + DrawerTitle, + DrawerTrigger, +} from '@/components/ui/drawer' +import { useMediaQuery } from '@/lib/hooks' +import { Heart } from 'lucide-react' +import { useState } from 'react' + +type Props = { + donationUrl: string +} + +export function DonationButton({ donationUrl }: Props) { + const isDesktop = useMediaQuery('(min-width: 768px)') + return isDesktop ? ( + + ) : ( + + ) +} + +function DonationDrawer({ donationUrl }: Props) { + const [open, setOpen] = useState(false) + + return ( + + + + + + + Support us + + Help keep Spliit free and without ads! + + +
+ +
+
+
+ ) +} + +function DonationDialog({ donationUrl }: Props) { + const [open, setOpen] = useState(false) + + return ( + + + + + + + Support us + + Help keep Spliit free and without ads! + + + + + + ) +} + +function DonationForm({ donationUrl }: Props) { + return ( + <> +
+

+ Spliit is offered for free, but costs money and energy. If you like + the app, you can choose to support it by buying me (Sebastien) a + coffee with a one-time small donation. +

+

By supporting Spliit:

+
    +
  • + You contribute to the hosting costs for the app + (currently ~$150/year). +
  • +
  • + You help us keeping the application{' '} + free and without ads. +
  • +
  • + You give me energy to build new features and + improve the application. +
  • +
+

+ You will be redirected to Stripe, our payment + provider, where you can choose an amount to donate and complete the + payment. +

+
+
+ +
+ + ) +} -- cgit v1.3