irongit

added copy button

huncholanehuncholaneauthored
parent 7670eeacommit 40b3ed0113db7fb370ac713eae9546f809032efdBrowse files

4 files changed, +49 -5

+5-2twench_landing_page/app/layout.tsx
@@ -1,8 +1,10 @@
1+import Footer from "@/components/Footer";
2+import Header from "@/components/Header";
13 import type { Metadata } from "next";
24 import localFont from "next/font/local";
5+import { ToastContainer } from "react-toastify";
6+import "react-toastify/dist/ReactToastify.css";
37 import "./globals.css";
4-import Footer from "@/components/Footer";
5-import Header from "@/components/Header";
68
79 const pixellari = localFont({
810 src: "./fonts/Pixellari.ttf",
@@ -26,6 +28,7 @@ export default function RootLayout({
2628 <Header />
2729 {children}
2830 <Footer />
31+ <ToastContainer className={"text-shadow-none w-[320px] text-[8px]"} />
2932 </body>
3033 </html>
3134 );
+18-1twench_landing_page/components/BuySection/BuySection.tsx
@@ -1,7 +1,10 @@
1+"use client";
12 import React from "react";
23 import "./BuySection.css";
4+import { toast } from "react-toastify";
35
46 const BuySection: React.FC = () => {
7+ const ca = "GuFmsJrhxo9iVX7WpKGQ4kYg6yofMJLpWPypHM44pump";
58 return (
69 <div className="BuySection">
710 <div className="Content">
@@ -42,7 +45,21 @@ const BuySection: React.FC = () => {
4245 </div>
4346 </div>
4447 <div className="BackpackSoldier"></div>
45- <div className="CopyBtn">Click To Copy CA</div>
48+ <div
49+ className="CopyBtn"
50+ onClick={() => {
51+ navigator.clipboard
52+ .writeText(ca)
53+ .then(() => {
54+ toast.success(`${ca} copied to clipboard!`);
55+ })
56+ .catch((err) => {
57+ toast.error("Failed to copy text to clipboard.");
58+ });
59+ }}
60+ >
61+ Click To Copy CA
62+ </div>
4663 </div>
4764 </div>
4865 );
+24-1twench_landing_page/package-lock.json
@@ -10,7 +10,8 @@
1010 "dependencies": {
1111 "next": "14.2.15",
1212 "react": "^18",
13- "react-dom": "^18"
13+ "react-dom": "^18",
14+ "react-toastify": "^10.0.6"
1415 },
1516 "devDependencies": {
1617 "@tailwindcss/aspect-ratio": "^0.4.2",
@@ -1250,6 +1251,15 @@
12501251 "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==",
12511252 "license": "MIT"
12521253 },
1254+ "node_modules/clsx": {
1255+ "version": "2.1.1",
1256+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
1257+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
1258+ "license": "MIT",
1259+ "engines": {
1260+ "node": ">=6"
1261+ }
1262+ },
12531263 "node_modules/color-convert": {
12541264 "version": "2.0.1",
12551265 "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -4143,6 +4153,19 @@
41434153 "dev": true,
41444154 "license": "MIT"
41454155 },
4156+ "node_modules/react-toastify": {
4157+ "version": "10.0.6",
4158+ "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.6.tgz",
4159+ "integrity": "sha512-yYjp+omCDf9lhZcrZHKbSq7YMuK0zcYkDFTzfRFgTXkTFHZ1ToxwAonzA4JI5CxA91JpjFLmwEsZEgfYfOqI1A==",
4160+ "license": "MIT",
4161+ "dependencies": {
4162+ "clsx": "^2.1.0"
4163+ },
4164+ "peerDependencies": {
4165+ "react": ">=18",
4166+ "react-dom": ">=18"
4167+ }
4168+ },
41464169 "node_modules/read-cache": {
41474170 "version": "1.0.0",
41484171 "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
+2-1twench_landing_page/package.json
@@ -11,7 +11,8 @@
1111 "dependencies": {
1212 "next": "14.2.15",
1313 "react": "^18",
14- "react-dom": "^18"
14+ "react-dom": "^18",
15+ "react-toastify": "^10.0.6"
1516 },
1617 "devDependencies": {
1718 "@tailwindcss/aspect-ratio": "^0.4.2",