Dariky commited on
Commit
175f830
·
verified ·
1 Parent(s): 7586731

Upload pages/index.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. pages/index.js +74 -0
pages/index.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react';
2
+ import PrintModal from '../components/PrintModal';
3
+ import PrintableContent from '../components/PrintableContent';
4
+ import CardsSection from '../components/CardsSection';
5
+ import Header from '../components/Header';
6
+ import Footer from '../components/Footer';
7
+
8
+ export default function Home() {
9
+ const [isModalOpen, setIsModalOpen] = useState(false);
10
+
11
+ const openModal = () => {
12
+ setIsModalOpen(true);
13
+ };
14
+
15
+ const closeModal = () => {
16
+ setIsModalOpen(false);
17
+ };
18
+
19
+ return (
20
+ <div className="min-h-screen bg-gray-50">
21
+ <Header />
22
+
23
+ <main className="container mx-auto px-4 py-8">
24
+ <div className="mb-12 text-center">
25
+ <h1 className="text-4xl font-bold text-gray-900">
26
+ Print Modal in React
27
+ </h1>
28
+ <p className="mt-4 text-xl text-gray-600">
29
+ A simple and elegant solution for printing specific content using a modal
30
+ </p>
31
+ </div>
32
+
33
+ <div className="mb-12 rounded-xl bg-gradient-to-r from-blue-500 to-indigo-600 p-8 text-white shadow-lg">
34
+ <h2 className="text-2xl font-bold">How it works</h2>
35
+ <div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
36
+ <div className="rounded-lg bg-white bg-opacity-20 p-4">
37
+ <div className="mb-2 text-2xl font-bold">1</div>
38
+ <p>Click the print button on any card</p>
39
+ </div>
40
+ <div className="rounded-lg bg-white bg-opacity-20 p-4">
41
+ <div className="mb-2 text-2xl font-bold">2</div>
42
+ <p>View the content in the print preview modal</p>
43
+ </div>
44
+ <div className="rounded-lg bg-white bg-opacity-20 p-4">
45
+ <div className="mb-2 text-2xl font-bold">3</div>
46
+ <p>Print the content with a clean layout</p>
47
+ </div>
48
+ </div>
49
+ </div>
50
+
51
+ <CardsSection onPrintClick={openModal} />
52
+
53
+ <div className="mt-12 rounded-xl bg-white p-6 shadow-md">
54
+ <h2 className="text-2xl font-bold text-gray-900">Printable Content</h2>
55
+ <p className="mt-2 text-gray-600">
56
+ Click the button below to open the print modal and preview the content
57
+ </p>
58
+ <button
59
+ onClick={openModal}
60
+ className="mt-6 rounded-lg bg-blue-600 px-6 py-3 text-white transition-colors hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
61
+ >
62
+ Open Print Modal
63
+ </button>
64
+ </div>
65
+ </main>
66
+
67
+ <Footer />
68
+
69
+ <PrintModal isOpen={isModalOpen} onClose={closeModal}>
70
+ <PrintableContent />
71
+ </PrintModal>
72
+ </div>
73
+ );
74
+ }