Skip to content

Commit

Permalink
make donation component
Browse files Browse the repository at this point in the history
  • Loading branch information
bnsx committed Jun 9, 2024
1 parent 73c5239 commit ceaa6fe
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/main-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { ReducerMany, ReturnProps } from "@/lib/reducer";
import { toByte } from "@/lib/size";
import { toast } from "sonner";
import UploadedList from "@/components/UploadedList";
import Donation from "@/components/Donation";

const schema = z.object({
unit: z.enum(["kb", "mb"]),
Expand Down Expand Up @@ -114,6 +115,7 @@ export default function MainForm() {
};
return (
<div className="xl:translate-y-32 grid xl:justify-center gap-1">
<Donation />
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} onReset={onReset}>
<Card className="xl:w-96">
Expand Down
49 changes: 49 additions & 0 deletions components/Donation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"use client";

import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Button } from "./ui/button";
import Image from "next/image";
import { toast } from "sonner";

export default function Donation() {
return (
<Dialog>
<DialogTrigger asChild>
<Button type="button" variant={"outline"} className="w-fit">
บริจาคค่าข้าว
</Button>
</DialogTrigger>
<DialogContent className="md:w-fit xl:w-fit">
<DialogHeader>
<DialogTitle>QR Prompt Pay</DialogTitle>
<DialogDescription className="text-ellipsis">
รองรับทุกธนาคารและ E-Wallet (รวมถึง True Wallet)
</DialogDescription>
</DialogHeader>
<div className="w-fit">
<Image src={"/qr-prompt-pay.png"} width={400} height={400} alt="" />
</div>
<DialogFooter>
<DialogClose asChild>
<Button
type="button"
variant={"outline"}
onClick={() => toast.success("ขอบพระคุณครับ 🙏")}
>
กินข้าวให้อร่อยนะ
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
);
}
8 changes: 6 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/** @type {import('next').NextConfig} */
const nextConfig = { output: "export", compress: true };
const nextConfig = {
output: "export",
compress: true,
images: { unoptimized: true },
};

export default nextConfig;
export default nextConfig;
Binary file added public/qr-prompt-pay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ceaa6fe

Please sign in to comment.