Spaces:
Running
Running
File size: 24,466 Bytes
6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af 455f785 6da99af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | <!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>بساز | UI Builder حرفهای</title>
<!-- Fonts & Icons -->
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/*
---------------------------------------------------------
Core Variables & Reset
---------------------------------------------------------
*/
:root {
/* App Theme Colors */
--app-bg: #0f172a;
--panel-bg: #1e293b;
--panel-border: #334155;
--text-main: #f8fafc;
--text-muted: #94a3b8;
--accent: #38bdf8;
--accent-hover: #0ea5e9;
--danger: #ef4444;
/* Card Defaults */
--card-bg: rgba(255, 255, 255, 0.05);
--card-border: rgba(255, 255, 255, 0.1);
--card-blur: 12px;
--card-radius: 24px;
--card-padding: 32px;
--card-width: 340px;
--card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
--card-text: #ffffff;
--card-img-radius: 50%;
/* Button Defaults */
--btn-bg: #38bdf8;
--btn-text: #0f172a;
--btn-radius: 50px;
--btn-padding: 12px 24px;
/* Font */
--font-main: 'Vazirmatn', sans-serif;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: var(--font-main);
background-color: var(--app-bg);
color: var(--text-main);
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
}
/*
---------------------------------------------------------
Background & Effects
---------------------------------------------------------
*/
.bg-mesh {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
overflow: hidden;
background: radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.15), transparent 25%),
radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
}
.orb {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.4;
animation: float 10s infinite ease-in-out alternate;
}
.orb-1 { width: 300px; height: 300px; background: #38bdf8; top: -50px; left: -50px; }
.orb-2 { width: 400px; height: 400px; background: #818cf8; bottom: -100px; right: -100px; animation-delay: -5s; }
@keyframes float {
0% { transform: translate(0, 0); }
100% { transform: translate(30px, 50px); }
}
/*
---------------------------------------------------------
Header
---------------------------------------------------------
*/
header {
height: 70px;
border-bottom: 1px solid var(--panel-border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30px;
background: rgba(15, 23, 42, 0.7);
backdrop-filter: blur(12px);
z-index: 100;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
font-size: 1.6rem;
font-weight: 900;
background: linear-gradient(135deg, #fff, #94a3b8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.brand i { -webkit-text-fill-color: var(--accent); }
.header-actions {
display: flex;
gap: 15px;
}
.anycoder-link {
text-decoration: none;
color: var(--text-muted);
font-size: 0.9rem;
display: flex;
align-items: center;
gap: 8px;
transition: 0.3s;
padding: 8px 16px;
border-radius: 12px;
background: rgba(255,255,255,0.05);
}
.anycoder-link:hover {
color: var(--accent);
background: rgba(255,255,255,0.1);
}
/*
---------------------------------------------------------
Main Layout
---------------------------------------------------------
*/
main {
display: flex;
flex: 1;
height: calc(100vh - 70px);
overflow: hidden;
}
/*
---------------------------------------------------------
Sidebar (Controls)
---------------------------------------------------------
*/
aside {
width: 380px;
background: var(--panel-bg);
border-left: 1px solid var(--panel-border);
display: flex;
flex-direction: column;
overflow: hidden;
box-shadow: -10px 0 30px rgba(0,0,0,0.2);
z-index: 10;
}
.sidebar-header {
padding: 20px;
border-bottom: 1px solid var(--panel-border);
font-weight: bold;
color: var(--accent);
display: flex;
justify-content: space-between;
align-items: center;
}
.scroll-area {
flex: 1;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 25px;
}
/* Custom Scrollbar */
.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 10px; }
.scroll-area::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.control-section h3 {
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--text-muted);
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 8px;
}
.input-group {
margin-bottom: 18px;
}
.input-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
label {
font-size: 0.9rem;
color: var(--text-main);
}
.value-display {
font-size: 0.8rem;
color: var(--text-muted);
font-family: monospace;
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
}
/* Modern Inputs */
input[type="text"],
textarea,
input[type="url"] {
width: 100%;
background: rgba(15, 23, 42, 0.6);
border: 1px solid var(--panel-border);
color: white;
padding: 10px 12px;
border-radius: 8px;
font-family: inherit;
font-size: 0.95rem;
transition: 0.2s;
}
input[type="text"]:focus,
textarea:focus,
input[type="url"]:focus {
border-color: var(--accent);
box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
textarea { resize: vertical; min-height: 80px; }
input[type="color"] {
-webkit-appearance: none;
border: none;
width: 32px;
height: 32px;
border-radius: 8px;
cursor: pointer;
background: none;
padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--panel-border); border-radius: 8px; }
input[type="range"] {
width: 100%;
height: 6px;
background: rgba(255,255,255,0.1);
border-radius: 5px;
outline: none;
-webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 18px;
height: 18px;
border-radius: 50%;
background: var(--accent);
cursor: pointer;
transition: 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
/*
---------------------------------------------------------
Preview Area
---------------------------------------------------------
*/
.preview-stage {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
position: relative;
perspective: 1000px;
overflow: hidden;
/* Optional: Checkerboard for transparency check */
background-image:
linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%),
linear-gradient(-45deg, rgba(255,255,255,0.03) 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.03) 75%),
linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.03) 75%);
background-size: 20px 20px;
}
/* Floating Elements for Depth */
.floating-shape {
position: absolute;
border-radius: 50%;
background: rgba(255,255,255,0.1);
z-index: 0;
}
.shape-1 { width: 200px; height: 200px; top: 20%; left: 20%; background: rgba(56, 189, 248, 0.2); filter: blur(40px); animation: float 8s infinite ease-in-out; }
.shape-2 { width: 150px; height: 150px; bottom: 30%; right: 20%; background: rgba(139, 92, 246, 0.2); filter: blur(40px); animation: float 12s infinite ease-in-out reverse; }
/* The Card */
#glass-card {
background: var(--card-bg);
backdrop-filter: blur(var(--card-blur));
-webkit-backdrop-filter: blur(var(--card-blur));
border: 1px solid var(--card-border);
border-radius: var(--card-radius);
padding: var(--card-padding);
width: var(--card-width);
max-width: 90%;
color: var(--card-text);
box-shadow: var(--card-shadow);
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 16px;
position: relative;
z-index: 1;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#glass-card img {
width: 100px;
height: 100px;
border-radius: var(--card-img-radius);
object-fit: cover;
border: 2px solid rgba(255,255,255,0.2);
transition: 0.3s;
}
#glass-card h3 { font-size: 1.5rem; margin: 0; font-weight: 700; }
#glass-card p { font-size: 0.95rem; line-height: 1.6; opacity: 0.9; margin: 0; }
#glass-card button {
margin-top: 10px;
background: var(--btn-bg);
color: var(--btn-text);
border: none;
padding: var(--btn-padding);
border-radius: var(--btn-radius);
font-weight: bold;
font-family: inherit;
cursor: pointer;
transition: 0.2s;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
#glass-card button:hover {
transform: translateY(-2px);
filter: brightness(1.1);
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
/*
---------------------------------------------------------
Code Panel (Bottom of Sidebar)
---------------------------------------------------------
*/
.code-panel {
background: #0f172a;
border-top: 1px solid var(--panel-border);
padding: 15px;
display: flex;
flex-direction: column;
gap: 10px;
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.code-output {
width: 100%;
height: 120px;
background: rgba(0,0,0,0.3);
border: 1px solid var(--panel-border);
border-radius: 8px;
color: #a5b4fc;
font-family: monospace;
font-size: 0.8rem;
padding: 10px;
resize: none;
}
.btn-copy {
width: 100%;
padding: 12px;
background: var(--accent);
color: #0f172a;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
transition: 0.2s;
}
.btn-copy:hover { background: var(--accent-hover); }
.toast {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%) translateY(100px);
background: var(--accent);
color: #0f172a;
padding: 10px 20px;
border-radius: 30px;
font-weight: bold;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
z-index: 1000;
display: flex;
align-items: center;
gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
/*
---------------------------------------------------------
Responsive Design
---------------------------------------------------------
*/
@media (max-width: 900px) {
body { overflow: auto; height: auto; }
main { flex-direction: column; height: auto; }
aside {
width: 100%;
height: auto;
border-left: none;
border-bottom: 1px solid var(--panel-border);
}
.preview-stage {
min-height: 500px;
padding: 40px 20px;
}
.scroll-area {
max-height: 400px; /* Limit height on mobile sidebar */
}
}
</style>
</head>
<body>
<!-- Background Animation -->
<div class="bg-mesh">
<div class="orb orb-1"></div>
<div class="orb orb-2"></div>
</div>
<header>
<div class="brand">
<i class="fa-solid fa-layer-group"></i>
بساز
</div>
<div class="header-actions">
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
<span>Built with Anycoder</span>
<i class="fa-solid fa-code"></i>
</a>
</div>
</header>
<main>
<!-- Sidebar Controls -->
<aside>
<div class="sidebar-header">
<span>تنظیمات ظاهری</span>
<i class="fa-solid fa-sliders"></i>
</div>
<div class="scroll-area">
<!-- Section 1: Content -->
<div class="control-section">
<h3><i class="fa-solid fa-pen-to-square"></i> محتوا</h3>
<div class="input-group">
<label>تصویر پروفایل (URL)</label>
<input type="url" id="inp-img" value="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=500&q=80" placeholder="لینک عکس...">
</div>
<div class="input-group">
<label>عنوان</label>
<input type="text" id="inp-title" value="عنوان دلخواه شما">
</div>
<div class="input-group">
<label>توضیحات</label>
<textarea id="inp-desc">این یک متن نمونه برای کارت گلسمورفیسم است. میتوانید این متن را به راحتی ویرایش کنید.</textarea>
</div>
<div class="input-group">
<label>متن دکمه</label>
<input type="text" id="inp-btn-text" value="شروع کنید">
</div>
</div>
<!-- Section 2: Glass Effect -->
<div class="control-section">
<h3><i class="fa-solid fa-wand-magic-sparkles"></i> افکت شیشهای</h3>
<div class="input-group">
<div class="input-row">
<label>رنگ پسزمینه</label>
<input type="color" id="inp-color-bg" value="#ffffff">
</div>
<input type="range" id="inp-opacity" min="0" max="1" step="0.05" value="0.1">
</div>
<div class="input-group">
<div class="input-row">
<label>رنگ حاشیه</label>
<input type="color" id="inp-color-border" value="#ffffff">
</div>
<input type="range" id="inp-border-opacity" min="0" max="1" step="0.05" value="0.2">
</div>
<div class="input-group">
<div class="input-row">
<label>تاری پسزمینه (Blur)</label>
<span class="value-display" id="val-blur">12px</span>
</div>
<input type="range" id="inp-blur" min="0" max="50" value="12">
</div>
</div>
<!-- Section 3: Shape & Layout -->
<div class="control-section">
<h3><i class="fa-solid fa-border-all"></i> ابعاد و شکل</h3>
<div class="input-group">
<div class="input-row">
<label>شعاع گوشهها</label>
<span class="value-display" id="val-radius">24px</span>
</div>
<input type="range" id="inp-radius" min="0" max="60" value="24">
</div>
<div class="input-group">
<div class="input-row">
<label>عرض کارت</label>
<span class="value-display" id="val-width">340px</span>
</div>
<input type="range" id="inp-width" min="200" max="600" value="340">
</div>
<div class="input-group">
<label>رنگ متن</label>
<input type="color" id="inp-text-color" value="#ffffff">
</div>
</div>
<!-- Section 4: Button -->
<div class="control-section">
<h3><i class="fa-solid fa-hand-pointer"></i> استایل دکمه</h3>
<div class="input-group">
<label>رنگ دکمه</label>
<input type="color" id="inp-btn-bg" value="#38bdf8">
</div>
<div class="input-group">
<div class="input-row">
<label>شعاع دکمه</label>
<span class="value-display" id="val-btn-radius">50px</span>
</div>
<input type="range" id="inp-btn-radius" min="0" max="50" value="50">
</div>
</div>
</div>
<!-- Code Output -->
<div class="code-panel">
<div class="code-header">
<label>کد خروجی HTML & CSS</label>
<i class="fa-solid fa-code" style="color: var(--text-muted)"></i>
</div>
<textarea id="code-output" class="code-output" readonly></textarea>
<button class="btn-copy" onclick="copyCode()">
<i class="fa-regular fa-copy"></i> کپی کد
</button>
</div>
</aside>
<!-- Live Preview -->
<section class="preview-stage">
<!-- Decorative Background Shapes -->
<div class="floating-shape shape-1"></div>
<div class="floating-shape shape-2"></div>
<!-- The Card -->
<div id="glass-card">
<img src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=500&q=80" id="card-img" alt="Profile">
<h3 id="card-title">عنوان دلخواه شما</h3>
<p id="card-desc">این یک متن نمونه برای کارت گلسمورفیسم است. میتوانید این متن را به راحتی ویرایش کنید.</p>
<button id="card-btn">شروع کنید</button>
</div>
</section>
</main>
<!-- Toast Notification -->
<div id="toast" class="toast">
<i class="fa-solid fa-check-circle"></i>
کد با موفقیت کپی شد!
</div>
<script>
// --- Configuration & Selectors ---
const inputs = {
title: document.getElementById('inp-title'),
desc: document.getElementById('inp-desc'),
img: document.getElementById('inp-img'),
btnText: document.getElementById('inp-btn-text'),
// Colors
bgColor: document.getElementById('inp-color-bg'),
bgOpacity: document.getElementById('inp-opacity'),
borderColor: document.getElementById('inp-color-border'),
borderOpacity: document.getElementById('inp-border-opacity'),
textColor: document.getElementById('inp-text-color'),
btnBg: document.getElementById('inp-btn-bg'),
// Sliders
blur: document.getElementById('inp-blur'),
radius: document.getElementById('inp-radius'),
width: document.getElementById('inp-width'),
btnRadius: document.getElementById('inp-btn-radius'),
};
const card = {
root: document.getElementById('glass-card'),
img: document.getElementById('card-img'),
title: document.getElementById('card-title'),
desc: document.getElementById('card-desc'),
btn: document.getElementById('card-btn')
};
const displays = {
blur: document.getElementById('val-blur'),
radius: document.getElementById('val-radius'),
width: document.getElementById('val-width'),
btnRadius: document.getElementById('val-btn-radius'),
};
const codeOutput = document.getElementById('code-output');
const toast = document.getElementById('toast');
// --- Helper Functions ---
// Convert Hex to RGBA
function hexToRgba(hex, opacity) {
let r = 0, g = 0, b = 0;
// 3 digits
if (hex.length === 4) {
r = "0x" + hex[1] + hex[1];
g = "0x" + hex[2] + hex[2];
b = "0x" + hex[3] + hex[3];
} else if (hex.length === 7) {
// 6 digits
r = "0x" + hex[1] + hex[2];
g = "0x" + hex[3] + hex[4];
b = "0x" + hex[5] + hex[6];
}
return `rgba(${+r}, ${+g}, ${+b}, ${opacity})`;
}
// --- Core Logic ---
function updateUI() {
// 1. Content
card.title.textContent = inputs.title.value;
card.desc.textContent = inputs.desc.value;
card.btn.textContent = inputs.btnText.value;
card.img.src = inputs.img.value;
// 2. Calculate Colors
const bgStyle = hexToRgba(inputs.bgColor.value, inputs.bgOpacity.value);
const borderStyle = hexToRgba(inputs.borderColor.value, inputs.borderOpacity.value);
// 3. Apply Styles to Card
card.root.style.setProperty('--card-bg', bgStyle);
card.root.style.setProperty('--card-border', borderStyle);
card.root.style.setProperty('--card-blur', `${inputs.blur.value}px`);
card.root.style.setProperty('--card-radius', `${inputs.radius.value}px`);
card.root.style.setProperty('--card-width', `${inputs.width.value}px`);
card.root.style.setProperty('--card-text', inputs.textColor.value);
card.root.style.setProperty('--btn-bg', inputs.btnBg.value);
card.root.style.setProperty('--btn-radius', `${inputs.btnRadius.value}px`);
// 4. Update Text Displays
displays.blur.textContent = `${inputs.blur.value}px`;
displays.radius.textContent = `${inputs.radius.value}px`;
displays.width.textContent = `${inputs.width.value}px`;
displays.btnRadius.textContent = `${inputs.btnRadius.value}px`;
// 5. Generate Code
generateCode(bgStyle, borderStyle);
}
function generateCode(bgStyle, borderStyle) {
const code = `
<!-- Glassmorphism Card -->
<style>
.glass-card {
/* Dimensions */
width: ${inputs.width.value}px;
max-width: 100%;
padding: 32px;
border-radius: ${inputs.radius.value}px;
/* Glass Effect */
background: ${bgStyle};
backdrop-filter: blur(${inputs.blur.value}px);
-webkit-backdrop-filter: blur(${inputs.blur.value}px);
border: 1px solid ${borderStyle};
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
/* Text */
color: ${inputs.textColor.value};
font-family: 'Tahoma', sans-serif; /* Or Vazirmatn */
text-align: center;
/* Layout */
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
}
.glass-card img {
width: 100px;
height: 100px;
border-radius: 50%;
object-fit: cover;
border: 2px solid rgba(255,255,255,0.2);
}
.glass-card button {
margin-top: 10px;
padding: 12px 24px;
background: ${inputs.btnBg.value};
color: #fff; /* Assuming white text for button, use contrast checker for prod */
border: none;
border-radius: ${inputs.btnRadius.value}px;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s;
}
.glass-card button:hover {
transform: scale(1.05);
}
</style>
<div class="glass-card">
<img src="${inputs.img.value}" alt="Profile">
<h3>${inputs.title.value}</h3>
<p>${inputs.desc.value}</p>
<button>${inputs.btnText.value}</button>
</div>
`;
codeOutput.value = code.trim();
}
function copyCode() {
codeOutput.select();
document.execCommand('copy');
// Show Toast
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 2500);
}
// --- Event Listeners ---
// Attach listener to all inputs
Object.values(inputs).forEach(input => {
input.addEventListener('input', updateUI);
});
// Initial Load
updateUI();
</script>
</body>
</html> |