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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>React-Style Print Modal</title>
|
| 7 |
+
|
| 8 |
+
<!-- Import React & ReactDOM (Simulated for Logic Context) -->
|
| 9 |
+
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
|
| 10 |
+
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
|
| 11 |
+
|
| 12 |
+
<!-- Import Babel (To compile JSX in browser) -->
|
| 13 |
+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
| 14 |
+
|
| 15 |
+
<!-- FontAwesome for Icons -->
|
| 16 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 17 |
+
|
| 18 |
+
<style>
|
| 19 |
+
:root {
|
| 20 |
+
--primary-color: #6366f1;
|
| 21 |
+
--primary-hover: #4f46e5;
|
| 22 |
+
--bg-color: #f3f4f6;
|
| 23 |
+
--text-color: #1f2937;
|
| 24 |
+
--modal-bg: #ffffff;
|
| 25 |
+
--shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 26 |
+
--border-radius: 12px;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
* {
|
| 30 |
+
box-sizing: border-box;
|
| 31 |
+
margin: 0;
|
| 32 |
+
padding: 0;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
body {
|
| 36 |
+
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
| 37 |
+
background-color: var(--bg-color);
|
| 38 |
+
color: var(--text-color);
|
| 39 |
+
display: flex;
|
| 40 |
+
flex-direction: column;
|
| 41 |
+
align-items: center;
|
| 42 |
+
min-height: 100vh;
|
| 43 |
+
padding: 2rem;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/* Header Section */
|
| 47 |
+
header {
|
| 48 |
+
text-align: center;
|
| 49 |
+
margin-bottom: 3rem;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
h1 {
|
| 53 |
+
font-size: 2.5rem;
|
| 54 |
+
font-weight: 800;
|
| 55 |
+
color: #111;
|
| 56 |
+
margin-bottom: 0.5rem;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
p.subtitle {
|
| 60 |
+
color: #6b7280;
|
| 61 |
+
font-size: 1.1rem;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.badge {
|
| 65 |
+
display: inline-block;
|
| 66 |
+
background: #e0e7ff;
|
| 67 |
+
color: var(--primary-color);
|
| 68 |
+
padding: 4px 12px;
|
| 69 |
+
border-radius: 20px;
|
| 70 |
+
font-size: 0.8rem;
|
| 71 |
+
font-weight: 600;
|
| 72 |
+
margin-bottom: 1rem;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/* Application Container (Simulating React App) */
|
| 76 |
+
.app-container {
|
| 77 |
+
width: 100%;
|
| 78 |
+
max-width: 600px;
|
| 79 |
+
background: white;
|
| 80 |
+
padding: 2rem;
|
| 81 |
+
border-radius: var(--border-radius);
|
| 82 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.control-panel {
|
| 86 |
+
display: flex;
|
| 87 |
+
gap: 1rem;
|
| 88 |
+
margin-bottom: 2rem;
|
| 89 |
+
padding-bottom: 2rem;
|
| 90 |
+
border-bottom: 2px solid #e5e7eb;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/* Modern Button Styles */
|
| 94 |
+
button {
|
| 95 |
+
cursor: pointer;
|
| 96 |
+
padding: 10px 20px;
|
| 97 |
+
border-radius: 8px;
|
| 98 |
+
font-weight: 600;
|
| 99 |
+
font-size: 1rem;
|
| 100 |
+
transition: all 0.2s ease;
|
| 101 |
+
border: none;
|
| 102 |
+
display: flex;
|
| 103 |
+
align-items: center;
|
| 104 |
+
gap: 8px;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
.btn-primary {
|
| 108 |
+
background-color: var(--primary-color);
|
| 109 |
+
color: white;
|
| 110 |
+
box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.btn-primary:hover {
|
| 114 |
+
background-color: var(--primary-hover);
|
| 115 |
+
transform: translateY(-1px);
|
| 116 |
+
box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.btn-secondary {
|
| 120 |
+
background-color: white;
|
| 121 |
+
color: #4b5563;
|
| 122 |
+
border: 1px solid #d1d5db;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.btn-secondary:hover {
|
| 126 |
+
background-color: #f9fafb;
|
| 127 |
+
color: #1f2937;
|
| 128 |
+
border-color: #9ca3af;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/* Content Placeholder (Simulating the "Data" in State) */
|
| 132 |
+
.dummy-content {
|
| 133 |
+
background: #f9fafb;
|
| 134 |
+
padding: 1.5rem;
|
| 135 |
+
border-radius: 8px;
|
| 136 |
+
border: 1px dashed #d1d5db;
|
| 137 |
+
margin-bottom: 1.5rem;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.dummy-content h3 { margin-bottom: 0.5rem; font-size: 1.2rem; }
|
| 141 |
+
.dummy-content p { line-height: 1.6; color: #4b5563; margin-bottom: 0.5rem; }
|
| 142 |
+
.tag { display: inline-block; background: #e5e7eb; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; margin-right: 5px;}
|
| 143 |
+
|
| 144 |
+
/* Modal Overlay */
|
| 145 |
+
.modal-overlay {
|
| 146 |
+
position: fixed;
|
| 147 |
+
top: 0;
|
| 148 |
+
left: 0;
|
| 149 |
+
width: 100%;
|
| 150 |
+
height: 100%;
|
| 151 |
+
background-color: rgba(0, 0, 0, 0.6);
|
| 152 |
+
backdrop-filter: blur(4px);
|
| 153 |
+
z-index: 100;
|
| 154 |
+
display: flex;
|
| 155 |
+
justify-content: center;
|
| 156 |
+
align-items: center;
|
| 157 |
+
opacity: 0;
|
| 158 |
+
visibility: hidden;
|
| 159 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.modal-overlay.active {
|
| 163 |
+
opacity: 1;
|
| 164 |
+
visibility: visible;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/* Modal Content Box */
|
| 168 |
+
.modal-content {
|
| 169 |
+
background: var(--modal-bg);
|
| 170 |
+
width: 90%;
|
| 171 |
+
max-width: 700px;
|
| 172 |
+
max-height: 90vh;
|
| 173 |
+
border-radius: var(--border-radius);
|
| 174 |
+
box-shadow: var(--shadow-lg);
|
| 175 |
+
transform: scale(0.95) translateY(20px);
|
| 176 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 177 |
+
display: flex;
|
| 178 |
+
flex-direction: column;
|
| 179 |
+
overflow: hidden;
|
| 180 |
+
position: relative;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
.modal-overlay.active .modal-content {
|
| 184 |
+
transform: scale(1) translateY(0);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
/* Modal Header */
|
| 188 |
+
.modal-header {
|
| 189 |
+
padding: 1.5rem;
|
| 190 |
+
border-bottom: 1px solid #e5e7eb;
|
| 191 |
+
display: flex;
|
| 192 |
+
justify-content: space-between;
|
| 193 |
+
align-items: center;
|
| 194 |
+
background: #f9fafb;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
.modal-title {
|
| 198 |
+
font-size: 1.5rem;
|
| 199 |
+
font-weight: 700;
|
| 200 |
+
color: #111;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
.close-btn {
|
| 204 |
+
background: none;
|
| 205 |
+
border: none;
|
| 206 |
+
font-size: 1.5rem;
|
| 207 |
+
color: #6b7280;
|
| 208 |
+
padding: 5px;
|
| 209 |
+
line-height: 1;
|
| 210 |
+
transition: color 0.2s;
|
| 211 |
+
}
|
| 212 |
+
.close-btn:hover { color: #111; background: #e5e7eb; border-radius: 50%; }
|
| 213 |
+
|
| 214 |
+
/* Modal Body (The part we want to print) */
|
| 215 |
+
.modal-body {
|
| 216 |
+
padding: 3rem;
|
| 217 |
+
overflow-y: auto;
|
| 218 |
+
flex: 1;
|
| 219 |
+
/* Print specific styling for the body */
|
| 220 |
+
@media print {
|
| 221 |
+
padding: 0;
|
| 222 |
+
overflow: visible;
|
| 223 |
+
height: auto;
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
/* Print Specific Styles (The Core Logic) */
|
| 228 |
+
@media print {
|
| 229 |
+
/* Hide everything in the body that isn't the modal */
|
| 230 |
+
body * {
|
| 231 |
+
visibility: hidden;
|
| 232 |
+
opacity: 0;
|
| 233 |
+
display: none !important;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/* Show the modal overlay and content */
|
| 237 |
+
.modal-overlay, .modal-overlay * {
|
| 238 |
+
visibility: visible;
|
| 239 |
+
opacity: 1;
|
| 240 |
+
display: block !important;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
/* Position the modal to fill the paper */
|
| 244 |
+
.modal-overlay {
|
| 245 |
+
position: absolute;
|
| 246 |
+
left: 0;
|
| 247 |
+
top: 0;
|
| 248 |
+
width: 100%;
|
| 249 |
+
background: white; /* Remove backdrop */
|
| 250 |
+
backdrop-filter: none;
|
| 251 |
+
display: block !important;
|
| 252 |
+
padding: 20px;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
/* Ensure the content box is white and full width */
|
| 256 |
+
.modal-content {
|
| 257 |
+
width: 100%;
|
| 258 |
+
max-width: 100%;
|
| 259 |
+
height: auto;
|
| 260 |
+
box-shadow: none;
|
| 261 |
+
border: none;
|
| 262 |
+
display: block;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
/* Hide the close button specifically during print */
|
| 266 |
+
.close-btn, .modal-header [data-action="close"] {
|
| 267 |
+
display: none !important;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
/* Remove scrollbars for print */
|
| 271 |
+
.modal-body {
|
| 272 |
+
overflow: visible;
|
| 273 |
+
padding: 20px;
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
/* Document Design (What the user sees in the modal) */
|
| 278 |
+
.document-preview {
|
| 279 |
+
font-family: 'Georgia', serif;
|
| 280 |
+
line-height: 1.6;
|
| 281 |
+
color: #333;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.doc-header {
|
| 285 |
+
border-bottom: 2px solid #111;
|
| 286 |
+
padding-bottom: 1rem;
|
| 287 |
+
margin-bottom: 2rem;
|
| 288 |
+
display: flex;
|
| 289 |
+
justify-content: space-between;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
.doc-title { font-size: 2rem; font-weight: bold; text-transform: uppercase; }
|
| 293 |
+
.doc-meta { text-align: right; font-family: sans-serif; font-size: 0.9rem; color: #666; }
|
| 294 |
+
|
| 295 |
+
.doc-section { margin-bottom: 2rem; }
|
| 296 |
+
.doc-section h2 { font-size: 1.2rem; margin-bottom: 1rem; border-bottom: 1px solid #ccc; padding-bottom: 0.3rem; }
|
| 297 |
+
.doc-section p { margin-bottom: 1rem; text-align: justify; }
|
| 298 |
+
|
| 299 |
+
.signature-area {
|
| 300 |
+
margin-top: 3rem;
|
| 301 |
+
display: flex;
|
| 302 |
+
justify-content: space-between;
|
| 303 |
+
border-top: 1px solid #ccc;
|
| 304 |
+
padding-top: 2rem;
|
| 305 |
+
}
|
| 306 |
+
.signature-box { width: 45%; }
|
| 307 |
+
.signature-box span { display: block; margin-top: 2rem; font-style: italic; border-bottom: 1px solid #333; width: 50%; }
|
| 308 |
+
.signature-label { font-size: 0.85rem; color: #555; margin-top: 0.5rem; }
|
| 309 |
+
|
| 310 |
+
/* Responsive adjustments */
|
| 311 |
+
@media (max-width: 600px) {
|
| 312 |
+
.control-panel { flex-direction: column; }
|
| 313 |
+
.modal-content { width: 95%; }
|
| 314 |
+
.signature-area { flex-direction: column; }
|
| 315 |
+
.signature-box { width: 100%; margin-bottom: 1rem; }
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
.notification {
|
| 319 |
+
position: fixed;
|
| 320 |
+
bottom: 20px;
|
| 321 |
+
right: 20px;
|
| 322 |
+
background: #10b981;
|
| 323 |
+
color: white;
|
| 324 |
+
padding: 12px 24px;
|
| 325 |
+
border-radius: 8px;
|
| 326 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 327 |
+
transform: translateY(100px);
|
| 328 |
+
transition: transform 0.3s ease;
|
| 329 |
+
z-index: 200;
|
| 330 |
+
display: flex;
|
| 331 |
+
align-items: center;
|
| 332 |
+
gap: 10px;
|
| 333 |
+
}
|
| 334 |
+
.notification.show { transform: translateY(0); }
|
| 335 |
+
|
| 336 |
+
</style>
|
| 337 |
+
</head>
|
| 338 |
+
<body>
|
| 339 |
+
|
| 340 |
+
<header>
|
| 341 |
+
<div class="badge">React Style • Vanilla JS</div>
|
| 342 |
+
<h1>Printable Modal</h1>
|
| 343 |
+
<p class="subtitle">Generate a clean print layout from a dynamic modal interface.</p>
|
| 344 |
+
</header>
|
| 345 |
+
|
| 346 |
+
<!-- Main Application Container -->
|
| 347 |
+
<div id="root"></div>
|
| 348 |
+
|
| 349 |
+
<!--
|
| 350 |
+
React Logic Simulation
|
| 351 |
+
Since we are in a single file without a build step, we use Babel to compile
|
| 352 |
+
JSX inside the script tag, mimicking standard React component structure.
|
| 353 |
+
-->
|
| 354 |
+
<script type="text/babel">
|
| 355 |
+
const { useState } = React;
|
| 356 |
+
|
| 357 |
+
// --- Sub-Components ---
|
| 358 |
+
|
| 359 |
+
const PrintIcon = () => <i className="fa-solid fa-print"></i>;
|
| 360 |
+
const CloseIcon = () => <i className="fa-solid fa-xmark"></i>;
|
| 361 |
+
const DownloadIcon = () => <i className="fa-solid fa-download"></i>;
|
| 362 |
+
|
| 363 |
+
// This component represents the "Document" inside the modal
|
| 364 |
+
const InvoiceDocument = ({ data }) => (
|
| 365 |
+
<div className="document-preview">
|
| 366 |
+
<div className="doc-header">
|
| 367 |
+
<div>
|
| 368 |
+
<div className="doc-title">Service Invoice</div>
|
| 369 |
+
<div style={{marginTop: '5px', fontSize: '0.9rem', color: '#666'}}>Ref: #{data.id}</div>
|
| 370 |
+
</div>
|
| 371 |
+
<div className="doc-meta">
|
| 372 |
+
<div>Date: {data.date}</div>
|
| 373 |
+
<div>Due: {data.dueDate}</div>
|
| 374 |
+
<div>Status: <strong style={{color: '#10b981'}}>{data.status}</strong></div>
|
| 375 |
+
</div>
|
| 376 |
+
</div>
|
| 377 |
+
|
| 378 |
+
<div className="doc-section">
|
| 379 |
+
<h2>Bill To</h2>
|
| 380 |
+
<p><strong>{data.client.name}</strong><br/>
|
| 381 |
+
{data.client.address}<br/>
|
| 382 |
+
{data.client.email}<br/>
|
| 383 |
+
{data.client.phone}</p>
|
| 384 |
+
</div>
|
| 385 |
+
|
| 386 |
+
<div className="doc-section">
|
| 387 |
+
<h2>Items</h2>
|
| 388 |
+
<table style={{width: '100%', borderCollapse: 'collapse'}}>
|
| 389 |
+
<thead>
|
| 390 |
+
<tr style={{borderBottom: '2px solid #ccc'}}>
|
| 391 |
+
<th style={{textAlign: 'left', padding: '8px'}}>Description</th>
|
| 392 |
+
<th style={{textAlign: 'right', padding: '8px'}}>Quantity</th>
|
| 393 |
+
<th style={{textAlign: 'right', padding: '8px'}}>Amount</th>
|
| 394 |
+
</tr>
|
| 395 |
+
</thead>
|
| 396 |
+
<tbody>
|
| 397 |
+
{data.items.map((item, idx) => (
|
| 398 |
+
<tr key={idx} style={{borderBottom: '1px solid #eee'}}>
|
| 399 |
+
<td style={{padding: '10px'}}>{item.name} <br/><span style={{fontSize: '0.8rem', color: '#888'}}>{item.desc}</span></td>
|
| 400 |
+
<td style={{padding: '10px', textAlign: 'right'}}>{item.qty}</td>
|
| 401 |
+
<td style={{padding: '10px', textAlign: 'right'}}>${item.price.toFixed(2)}</td>
|
| 402 |
+
</tr>
|
| 403 |
+
))}
|
| 404 |
+
</tbody>
|
| 405 |
+
</table>
|
| 406 |
+
</div>
|
| 407 |
+
|
| 408 |
+
<div className="doc-section" style={{display: 'flex', justifyContent: 'flex-end'}}>
|
| 409 |
+
<div style={{width: '300px'}}>
|
| 410 |
+
<div style={{display: 'flex', justifyContent: 'space-between', marginBottom: '10px'}}>
|
| 411 |
+
<span>Subtotal</span>
|
| 412 |
+
<span>${data.total.toFixed(2)}</span>
|
| 413 |
+
</div>
|
| 414 |
+
<div style={{display: 'flex', justifyContent: 'space-between', marginBottom: '10px'}}>
|
| 415 |
+
<span>Tax (8%)</span>
|
| 416 |
+
<span>${(data.total * 0.08).toFixed(2)}</span>
|
| 417 |
+
</div>
|
| 418 |
+
<div style={{display: 'flex', justifyContent: 'space-between', fontSize: '1.2rem', fontWeight: 'bold', borderTop: '2px solid #333', paddingTop: '10px'}}>
|
| 419 |
+
<span>Total</span>
|
| 420 |
+
<span>${(data.total * 1.08).toFixed(2)}</span>
|
| 421 |
+
</div>
|
| 422 |
+
</div>
|
| 423 |
+
</div>
|
| 424 |
+
|
| 425 |
+
<div className="signature-area">
|
| 426 |
+
<div className="signature-box">
|
| 427 |
+
<span></span>
|
| 428 |
+
<div className="signature-label">Authorized Signature</div>
|
| 429 |
+
</div>
|
| 430 |
+
<div className="signature-box" style={{textAlign: 'right'}}>
|
| 431 |
+
<div className="signature-label">Customer Copy</div>
|
| 432 |
+
<div style={{marginTop: '20px', fontSize: '0.8rem', fontStyle: 'italic', color: '#888'}}>
|
| 433 |
+
Thank you for your business! Please remit payment within 30 days.
|
| 434 |
+
</div>
|
| 435 |
+
</div>
|
| 436 |
+
</div>
|
| 437 |
+
</div>
|
| 438 |
+
);
|
| 439 |
+
|
| 440 |
+
// --- Main Application Component ---
|
| 441 |
+
const App = () => {
|
| 442 |
+
// State Simulation
|
| 443 |
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
| 444 |
+
const [notification, setNotification] = useState(false);
|
| 445 |
+
|
| 446 |
+
// Mock Data
|
| 447 |
+
const invoiceData = {
|
| 448 |
+
id: "INV-2023-001",
|
| 449 |
+
date: new Date().toLocaleDateString(),
|
| 450 |
+
dueDate: "2023-12-31",
|
| 451 |
+
status: "Pending",
|
| 452 |
+
client: {
|
| 453 |
+
name: "Acme Corporation",
|
| 454 |
+
address: "123 Innovation Drive\nTech City, TC 90210",
|
| 455 |
+
email: "billing@acmecorp.com",
|
| 456 |
+
phone: "(555) 123-4567"
|
| 457 |
+
},
|
| 458 |
+
items: [
|
| 459 |
+
{ name: "Web Development Services", desc: "Frontend & Backend Integration", qty: 40, price: 150.00 },
|
| 460 |
+
{ name: "UI/UX Design", desc: "High-fidelity Prototypes", qty: 15, price: 120.00 },
|
| 461 |
+
{ name: "Server Hosting", desc: "Annual Premium Plan", qty: 1, price: 500.00 }
|
| 462 |
+
],
|
| 463 |
+
total: 8600.00
|
| 464 |
+
};
|
| 465 |
+
|
| 466 |
+
const openModal = () => setIsModalOpen(true);
|
| 467 |
+
|
| 468 |
+
const closeModal = () => setIsModalOpen(false);
|
| 469 |
+
|
| 470 |
+
const handlePrint = () => {
|
| 471 |
+
// Trigger the browser print dialog
|
| 472 |
+
window.print();
|
| 473 |
+
|
| 474 |
+
// Show a temporary notification
|
| 475 |
+
setNotification(true);
|
| 476 |
+
setTimeout(() => setNotification(false), 3000);
|
| 477 |
+
};
|
| 478 |
+
|
| 479 |
+
return (
|
| 480 |
+
<>
|
| 481 |
+
<div className="app-container">
|
| 482 |
+
<div className="dummy-content">
|
| 483 |
+
<h3>Current View: Dashboard</h3>
|
| 484 |
+
<p>This application demonstrates how to extract content from a React-style modal for printing.</p>
|
| 485 |
+
<p>Click the button below to generate the invoice view in a modal, then use the print button inside to see the clean print layout.</p>
|
| 486 |
+
<div style={{marginTop: '10px'}}>
|
| 487 |
+
<span className="tag">React</span>
|
| 488 |
+
<span className="tag">CSS Media Queries</span>
|
| 489 |
+
<span className="tag">Vanilla JS</span>
|
| 490 |
+
</div>
|
| 491 |
+
</div>
|
| 492 |
+
|
| 493 |
+
<div className="control-panel">
|
| 494 |
+
<button className="btn-primary" onClick={openModal}>
|
| 495 |
+
<PrintIcon /> Generate Invoice Modal
|
| 496 |
+
</button>
|
| 497 |
+
<button className="btn-secondary" onClick={() => alert("This would save the current dashboard state.")}>
|
| 498 |
+
<DownloadIcon /> Save Draft
|
| 499 |
+
</button>
|
| 500 |
+
</div>
|
| 501 |
+
|
| 502 |
+
<p style={{textAlign: 'center', color: '#9ca3af', fontSize: '0.9rem'}}>
|
| 503 |
+
* Clicking "Generate Invoice Modal" simulates fetching dynamic data and opening a component.
|
| 504 |
+
</p>
|
| 505 |
+
</div>
|
| 506 |
+
|
| 507 |
+
{/* Modal Overlay - The Container */}
|
| 508 |
+
{isModalOpen && (
|
| 509 |
+
<div className="modal-overlay" onClick={closeModal}>
|
| 510 |
+
<div className="modal-content" onClick={e => e.stopPropagation()}>
|
| 511 |
+
|
| 512 |
+
{/* Modal Header */}
|
| 513 |
+
<div className="modal-header">
|
| 514 |
+
<div className="modal-title">
|
| 515 |
+
<i className="fa-solid fa-file-invoice-dollar" style={{color: '#6366f1', marginRight: '10px'}}></i>
|
| 516 |
+
Invoice #{invoiceData.id}
|
| 517 |
+
</div>
|
| 518 |
+
<div className="actions">
|
| 519 |
+
<button className="close-btn" onClick={closeModal} data-action="close" title="Close Modal">
|
| 520 |
+
<CloseIcon />
|
| 521 |
+
</button>
|
| 522 |
+
</div>
|
| 523 |
+
</div>
|
| 524 |
+
|
| 525 |
+
{/* Modal Body - This is the content we want to print */}
|
| 526 |
+
<div className="modal-body">
|
| 527 |
+
<InvoiceDocument data={invoiceData} />
|
| 528 |
+
</div>
|
| 529 |
+
|
| 530 |
+
{/* Modal Footer - Hidden during print via CSS logic or just for UI */}
|
| 531 |
+
<div className="modal-header" style={{justifyContent: 'flex-end', background: 'white', padding: '1rem 2rem'}}>
|
| 532 |
+
<button
|
| 533 |
+
className="btn-primary"
|
| 534 |
+
onClick={handlePrint}
|
| 535 |
+
style={{background: '#10b981', boxShadow: '0 4px 6px -1px rgba(16, 185, 129, 0.3)'}}
|
| 536 |
+
>
|
| 537 |
+
<PrintIcon /> Print Document
|
| 538 |
+
</button>
|
| 539 |
+
<button
|
| 540 |
+
className="btn-secondary"
|
| 541 |
+
onClick={closeModal}
|
| 542 |
+
style={{marginRight: '10px'}}
|
| 543 |
+
>
|
| 544 |
+
Cancel
|
| 545 |
+
</button>
|
| 546 |
+
</div>
|
| 547 |
+
|
| 548 |
+
</div>
|
| 549 |
+
</div>
|
| 550 |
+
)}
|
| 551 |
+
|
| 552 |
+
{/* Notification Toast */}
|
| 553 |
+
<div className={`notification ${notification ? 'show' : ''}`}>
|
| 554 |
+
<i className="fa-solid fa-check-circle" style={{fontSize: '1.2rem'}}></i>
|
| 555 |
+
<span>Print command sent to browser!</span>
|
| 556 |
+
</div>
|
| 557 |
+
</>
|
| 558 |
+
);
|
| 559 |
+
};
|
| 560 |
+
|
| 561 |
+
const root = ReactDOM.createRoot(document.getElementById('root'));
|
| 562 |
+
root.render(<App />);
|
| 563 |
+
</script>
|
| 564 |
+
|
| 565 |
+
<div style="margin-top: 50px; text-align: center; opacity: 0.7;">
|
| 566 |
+
<p>Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" style="color: #6366f1; text-decoration: none; font-weight: bold;">anycoder</a></p>
|
| 567 |
+
</div>
|
| 568 |
+
</body>
|
| 569 |
+
</html>
|