697 lines
37 KiB
HTML
697 lines
37 KiB
HTML
{# app/templates/admin/components.html #}
|
|
{% extends "admin/base.html" %}
|
|
|
|
{% block title %}UI Components{% endblock %}
|
|
|
|
{# ✅ CRITICAL: Link to Alpine.js component #}
|
|
{% block alpine_data %}adminComponents(){% endblock %}
|
|
|
|
{% block extra_head %}
|
|
{# Chart.js for charts section #}
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css" />
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js" defer></script>
|
|
<style>
|
|
/* Ensure sticky positioning works properly */
|
|
.sticky {
|
|
position: -webkit-sticky !important;
|
|
position: sticky !important;
|
|
}
|
|
/* Add smooth scrolling */
|
|
html {
|
|
scroll-behavior: smooth;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<!-- Page Header -->
|
|
<div class="flex items-center justify-between my-6">
|
|
<h2 class="text-2xl font-semibold text-gray-700 dark:text-gray-200">
|
|
UI Components Library
|
|
</h2>
|
|
<a href="/admin/dashboard" class="flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 dark:text-gray-300 dark:bg-gray-800 dark:border-gray-600 dark:hover:bg-gray-700">
|
|
<span x-html="$icon('arrow-left', 'w-4 h-4 mr-2')"></span>
|
|
Back to Dashboard
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Introduction -->
|
|
<div class="mb-8 p-6 bg-gradient-to-r from-purple-600 to-indigo-600 rounded-lg shadow-lg">
|
|
<div class="flex items-start">
|
|
<span x-html="$icon('collection', 'w-10 h-10 mr-4 flex-shrink-0 text-white')"></span>
|
|
<div>
|
|
<h3 class="text-xl font-bold mb-2 text-white">Quick Reference Library</h3>
|
|
<p class="text-white opacity-90">
|
|
Copy-paste ready UI components for your admin pages. All components support dark mode and are fully accessible.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Layout: Sidebar + Content -->
|
|
<div class="flex gap-6 relative">
|
|
|
|
<!-- Sticky Navigation Sidebar - FIXED FOR REAL -->
|
|
<div class="w-64 flex-shrink-0 self-start">
|
|
<div class="sticky top-24" style="position: -webkit-sticky; position: sticky;">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
|
|
<h3 class="text-sm font-semibold text-gray-600 dark:text-gray-400 uppercase mb-3">Sections</h3>
|
|
<nav class="space-y-1">
|
|
<template x-for="section in sections" :key="section.id">
|
|
<a
|
|
:href="'#' + section.id"
|
|
@click.prevent="goToSection(section.id)"
|
|
class="flex items-center px-3 py-2 text-sm rounded-lg transition-colors"
|
|
:class="isSectionActive(section.id)
|
|
? 'bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-200 font-medium'
|
|
: 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'"
|
|
>
|
|
<span x-html="$icon(section.icon, 'w-4 h-4 mr-2')"></span>
|
|
<span x-text="section.name"></span>
|
|
</a>
|
|
</template>
|
|
</nav>
|
|
</div>
|
|
|
|
<!-- Quick Tips -->
|
|
<div class="mt-4 bg-blue-50 dark:bg-gray-800 border border-blue-200 dark:border-gray-700 rounded-lg p-4">
|
|
<div class="flex items-start">
|
|
<span x-html="$icon('light-bulb', 'w-5 h-5 text-blue-600 dark:text-blue-400 mr-2 flex-shrink-0')"></span>
|
|
<div>
|
|
<p class="text-xs font-semibold text-blue-900 dark:text-blue-200 mb-1">Pro Tip</p>
|
|
<p class="text-xs text-blue-800 dark:text-blue-300">
|
|
Click any code block to copy it to your clipboard!
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Main Content - WIDELY SPACED SECTIONS -->
|
|
<div class="flex-1 space-y-32">
|
|
|
|
<!-- FORMS SECTION -->
|
|
<section id="forms" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('clipboard-list', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Forms
|
|
</h2>
|
|
|
|
<!-- Basic Input -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Basic Input</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<label class="block mb-4 text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">Field Label</span>
|
|
<input
|
|
type="text"
|
|
x-model="exampleForm.textInput"
|
|
placeholder="Enter text..."
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
|
|
/>
|
|
</label>
|
|
</div>
|
|
<button @click="copyCode(`<label class="block mb-4 text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">Field Label</span>
|
|
<input
|
|
type="text"
|
|
x-model="formData.field"
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-input"
|
|
/>
|
|
</label>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Required Field with Error -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Required Field with Error</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<label class="block mb-4 text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">
|
|
Email Address <span class="text-red-600">*</span>
|
|
</span>
|
|
<input
|
|
type="email"
|
|
x-model="exampleForm.email"
|
|
required
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple form-input border-red-600 focus:border-red-400 focus:shadow-outline-red"
|
|
/>
|
|
<span class="text-xs text-red-600 dark:text-red-400 mt-1" x-text="exampleErrors.email"></span>
|
|
</label>
|
|
</div>
|
|
<button @click="copyCode(`<label class="block mb-4 text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">
|
|
Field Label <span class="text-red-600">*</span>
|
|
</span>
|
|
<input
|
|
type="text"
|
|
x-model="formData.field"
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:bg-gray-700 focus:border-purple-400 form-input border-red-600"
|
|
/>
|
|
<span class="text-xs text-red-600 dark:text-red-400 mt-1">Error message</span>
|
|
</label>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Textarea -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Textarea</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<label class="block text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">Description</span>
|
|
<textarea
|
|
x-model="exampleForm.textarea"
|
|
rows="3"
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-textarea"
|
|
></textarea>
|
|
</label>
|
|
</div>
|
|
<button @click="copyCode(`<label class="block text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">Description</span>
|
|
<textarea
|
|
rows="3"
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 form-textarea"
|
|
></textarea>
|
|
</label>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Select -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Select</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<label class="block text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">Select Option</span>
|
|
<select
|
|
x-model="exampleForm.select"
|
|
class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray form-select"
|
|
>
|
|
<option value="option1">Option 1</option>
|
|
<option value="option2">Option 2</option>
|
|
<option value="option3">Option 3</option>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
<button @click="copyCode(`<label class="block text-sm">
|
|
<span class="text-gray-700 dark:text-gray-400">Select Option</span>
|
|
<select class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select">
|
|
<option>Option 1</option>
|
|
<option>Option 2</option>
|
|
</select>
|
|
</label>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- BUTTONS SECTION -->
|
|
<section id="buttons" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('cursor-click', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Buttons
|
|
</h2>
|
|
|
|
<!-- Primary Button -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Primary Button</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3 space-x-2">
|
|
<button class="px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700">
|
|
Primary Button
|
|
</button>
|
|
<button class="px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700 disabled:opacity-50" disabled>
|
|
Disabled
|
|
</button>
|
|
</div>
|
|
<button @click="copyCode(`<button class="px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700">
|
|
Primary Button
|
|
</button>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Secondary Button -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Secondary Button</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3 space-x-2">
|
|
<button class="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600 dark:hover:bg-gray-600">
|
|
Secondary Button
|
|
</button>
|
|
</div>
|
|
<button @click="copyCode(`<button class="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600 dark:hover:bg-gray-600">
|
|
Secondary Button
|
|
</button>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Danger Button -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Danger Button</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3 space-x-2">
|
|
<button class="px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700">
|
|
Delete
|
|
</button>
|
|
</div>
|
|
<button @click="copyCode(`<button class="px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700">
|
|
Delete
|
|
</button>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- CARDS SECTION -->
|
|
<section id="cards" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('collection', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Cards
|
|
</h2>
|
|
|
|
<!-- Basic Card -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Basic Card</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
|
|
<h4 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-2">Card Title</h4>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">
|
|
This is a basic card component with a title and description.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<button @click="copyCode(`<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
|
|
<h4 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-2">Card Title</h4>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Card description</p>
|
|
</div>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- BADGES SECTION -->
|
|
<section id="badges" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('tag', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Badges
|
|
</h2>
|
|
|
|
<!-- Status Badges -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Status Badges</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3 flex flex-wrap gap-2">
|
|
<span class="px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
|
|
Active
|
|
</span>
|
|
<span class="px-2 py-1 text-xs font-semibold text-yellow-800 bg-yellow-100 rounded-full dark:bg-yellow-700 dark:text-yellow-100">
|
|
Pending
|
|
</span>
|
|
<span class="px-2 py-1 text-xs font-semibold text-red-800 bg-red-100 rounded-full dark:bg-red-700 dark:text-red-100">
|
|
Inactive
|
|
</span>
|
|
<span class="px-2 py-1 text-xs font-semibold text-blue-800 bg-blue-100 rounded-full dark:bg-blue-700 dark:text-blue-100">
|
|
Info
|
|
</span>
|
|
</div>
|
|
<button @click="copyCode(`<span class="px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
|
|
Active
|
|
</span>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- TABLES SECTION -->
|
|
<section id="tables" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('table', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Tables
|
|
</h2>
|
|
|
|
<!-- Basic Table -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Basic Table</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3 overflow-x-auto">
|
|
<table class="w-full whitespace-no-wrap">
|
|
<thead>
|
|
<tr class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800">
|
|
<th class="px-4 py-3">Name</th>
|
|
<th class="px-4 py-3">Email</th>
|
|
<th class="px-4 py-3">Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
|
|
<tr class="text-gray-700 dark:text-gray-400">
|
|
<td class="px-4 py-3">John Doe</td>
|
|
<td class="px-4 py-3 text-sm">john@example.com</td>
|
|
<td class="px-4 py-3 text-xs">
|
|
<span class="px-2 py-1 font-semibold text-green-800 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
|
|
Active
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr class="text-gray-700 dark:text-gray-400">
|
|
<td class="px-4 py-3">Jane Smith</td>
|
|
<td class="px-4 py-3 text-sm">jane@example.com</td>
|
|
<td class="px-4 py-3 text-xs">
|
|
<span class="px-2 py-1 font-semibold text-yellow-800 bg-yellow-100 rounded-full dark:bg-yellow-700 dark:text-yellow-100">
|
|
Pending
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<button @click="copyCode(`<table class="w-full whitespace-no-wrap">
|
|
<thead>
|
|
<tr class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800">
|
|
<th class="px-4 py-3">Name</th>
|
|
<th class="px-4 py-3">Email</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
|
|
<tr class="text-gray-700 dark:text-gray-400">
|
|
<td class="px-4 py-3">John Doe</td>
|
|
<td class="px-4 py-3">john@example.com</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- MODALS SECTION -->
|
|
<section id="modals" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('view-grid-add', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Modals
|
|
</h2>
|
|
|
|
<!-- Confirmation Modal -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Confirmation Modal</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<button
|
|
@click="showExampleModal = true"
|
|
class="px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700">
|
|
Open Modal
|
|
</button>
|
|
|
|
<!-- Example Modal -->
|
|
<div
|
|
x-show="showExampleModal"
|
|
x-cloak
|
|
class="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"
|
|
@click.self="showExampleModal = false">
|
|
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 m-4 max-w-md w-full">
|
|
<div class="flex items-start justify-between mb-4">
|
|
<h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200">
|
|
Confirm Action
|
|
</h3>
|
|
<button
|
|
@click="showExampleModal = false"
|
|
class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
|
|
<span x-html="$icon('x', 'w-5 h-5')"></span>
|
|
</button>
|
|
</div>
|
|
|
|
<p class="mb-6 text-sm text-gray-600 dark:text-gray-400">
|
|
Are you sure you want to perform this action? This cannot be undone.
|
|
</p>
|
|
|
|
<div class="flex justify-end gap-3">
|
|
<button
|
|
@click="showExampleModal = false"
|
|
class="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600 dark:hover:bg-gray-600">
|
|
Cancel
|
|
</button>
|
|
<button
|
|
@click="showExampleModal = false"
|
|
class="px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700">
|
|
Confirm
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button @click="copyCode(`<!-- Modal Trigger -->
|
|
<button @click="showModal = true">Open Modal</button>
|
|
|
|
<!-- Modal -->
|
|
<div x-show="showModal"
|
|
class="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"
|
|
@click.self="showModal = false">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 m-4 max-w-md w-full">
|
|
<div class="flex items-start justify-between mb-4">
|
|
<h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200">Title</h3>
|
|
<button @click="showModal = false">
|
|
<span x-html="$icon('x', 'w-5 h-5')"></span>
|
|
</button>
|
|
</div>
|
|
<p class="mb-6 text-sm text-gray-600 dark:text-gray-400">Content</p>
|
|
<div class="flex justify-end gap-3">
|
|
<button @click="showModal = false">Cancel</button>
|
|
<button @click="showModal = false">Confirm</button>
|
|
</div>
|
|
</div>
|
|
</div>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- ALERTS SECTION -->
|
|
<section id="alerts" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('exclamation', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Alerts
|
|
</h2>
|
|
|
|
<!-- Toast Notifications -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Toast Notifications</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3 space-x-2">
|
|
<button
|
|
@click="showToastExample('success')"
|
|
class="px-4 py-2 text-sm font-medium text-white bg-green-600 rounded-lg hover:bg-green-700">
|
|
Show Success
|
|
</button>
|
|
<button
|
|
@click="showToastExample('error')"
|
|
class="px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700">
|
|
Show Error
|
|
</button>
|
|
<button
|
|
@click="showToastExample('warning')"
|
|
class="px-4 py-2 text-sm font-medium text-white bg-yellow-600 rounded-lg hover:bg-yellow-700">
|
|
Show Warning
|
|
</button>
|
|
<button
|
|
@click="showToastExample('info')"
|
|
class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700">
|
|
Show Info
|
|
</button>
|
|
</div>
|
|
<button @click="copyCode(`Utils.showToast('Message here', 'success'); // or 'error', 'warning', 'info'`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- CHARTS SECTION - NEW -->
|
|
<section id="charts" class="scroll-mt-24">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 dark:text-gray-200 mb-6 flex items-center">
|
|
<span x-html="$icon('chart-pie', 'w-6 h-6 mr-2 text-purple-600 dark:text-purple-400')"></span>
|
|
Charts
|
|
</h2>
|
|
|
|
<p class="mb-6 text-gray-600 dark:text-gray-400">
|
|
Charts are provided by
|
|
<a href="https://www.chartjs.org/" target="_blank" class="text-purple-600 dark:text-purple-400 hover:underline">
|
|
Chart.js
|
|
</a>. Note that default legends are disabled and you should provide descriptions for your charts in HTML.
|
|
</p>
|
|
|
|
<!-- Pie/Doughnut Chart -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Doughnut/Pie Chart</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg p-4">
|
|
<canvas id="examplePieChart"></canvas>
|
|
<div class="flex justify-center mt-4 space-x-3 text-sm text-gray-600 dark:text-gray-400">
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-teal-500 rounded-full"></span>
|
|
<span>Shoes</span>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-purple-600 rounded-full"></span>
|
|
<span>Shirts</span>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-blue-600 rounded-full"></span>
|
|
<span>Bags</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button @click="copyCode(`<canvas id="pieChart"></canvas>
|
|
<script>
|
|
const pieConfig = {
|
|
type: 'doughnut',
|
|
data: {
|
|
datasets: [{
|
|
data: [33, 33, 33],
|
|
backgroundColor: ['#0694a2', '#7e3af2', '#1c64f2'],
|
|
}],
|
|
labels: ['Shoes', 'Shirts', 'Bags'],
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
cutoutPercentage: 80,
|
|
legend: { display: false },
|
|
},
|
|
};
|
|
new Chart(document.getElementById('pieChart'), pieConfig);
|
|
</script>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Line Chart -->
|
|
<div class="mb-8">
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Line Chart</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg p-4">
|
|
<canvas id="exampleLineChart"></canvas>
|
|
<div class="flex justify-center mt-4 space-x-3 text-sm text-gray-600 dark:text-gray-400">
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-teal-500 rounded-full"></span>
|
|
<span>Organic</span>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-purple-600 rounded-full"></span>
|
|
<span>Paid</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button @click="copyCode(`<canvas id="lineChart"></canvas>
|
|
<script>
|
|
const lineConfig = {
|
|
type: 'line',
|
|
data: {
|
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
|
|
datasets: [{
|
|
label: 'Organic',
|
|
backgroundColor: '#0694a2',
|
|
borderColor: '#0694a2',
|
|
data: [43, 48, 40, 54, 67, 73, 70],
|
|
fill: false,
|
|
}, {
|
|
label: 'Paid',
|
|
fill: false,
|
|
backgroundColor: '#7e3af2',
|
|
borderColor: '#7e3af2',
|
|
data: [24, 50, 64, 74, 52, 51, 65],
|
|
}],
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
legend: { display: false },
|
|
},
|
|
};
|
|
new Chart(document.getElementById('lineChart'), lineConfig);
|
|
</script>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Bar Chart -->
|
|
<div>
|
|
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-3">Bar Chart</h3>
|
|
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-3">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg p-4">
|
|
<canvas id="exampleBarChart"></canvas>
|
|
<div class="flex justify-center mt-4 space-x-3 text-sm text-gray-600 dark:text-gray-400">
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-teal-500 rounded-full"></span>
|
|
<span>Shoes</span>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<span class="inline-block w-3 h-3 mr-1 bg-purple-600 rounded-full"></span>
|
|
<span>Bags</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button @click="copyCode(`<canvas id="barChart"></canvas>
|
|
<script>
|
|
const barConfig = {
|
|
type: 'bar',
|
|
data: {
|
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
|
|
datasets: [{
|
|
label: 'Shoes',
|
|
backgroundColor: '#0694a2',
|
|
data: [43, 48, 40, 54, 67, 73, 70],
|
|
}, {
|
|
label: 'Bags',
|
|
backgroundColor: '#7e3af2',
|
|
data: [24, 50, 64, 74, 52, 51, 65],
|
|
}],
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
legend: { display: false },
|
|
},
|
|
};
|
|
new Chart(document.getElementById('barChart'), barConfig);
|
|
</script>`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
|
|
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
|
|
Copy Code
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_scripts %}
|
|
{# ✅ CRITICAL: Load JavaScript file #}
|
|
<script src="{{ url_for('static', path='admin/js/components.js') }}"></script>
|
|
{% endblock %} |