tạo cho tôi giao diện đơn giản sử dụng jquery template, nhúng các cdn liên quan vào:
Browse files<script src="https://cdn.jsdelivr.net/npm/jquery-templates@1.0.0/jquery.tmpl.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
- README.md +8 -5
- components/navbar.js +35 -0
- index.html +75 -19
- script.js +49 -0
- style.css +26 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: jQuery Magic Template Wizard ✨
|
| 3 |
+
colorFrom: red
|
| 4 |
+
colorTo: gray
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
components/navbar.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
.navbar {
|
| 7 |
+
background-color: white;
|
| 8 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 9 |
+
}
|
| 10 |
+
.nav-link {
|
| 11 |
+
transition: all 0.2s ease;
|
| 12 |
+
}
|
| 13 |
+
.nav-link:hover {
|
| 14 |
+
color: #3b82f6;
|
| 15 |
+
}
|
| 16 |
+
</style>
|
| 17 |
+
<nav class="navbar py-4 px-6">
|
| 18 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 19 |
+
<a href="#" class="text-xl font-bold text-gray-800">jQuery Magic</a>
|
| 20 |
+
<div class="hidden md:flex space-x-8">
|
| 21 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">Home</a>
|
| 22 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">Templates</a>
|
| 23 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">Docs</a>
|
| 24 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">Examples</a>
|
| 25 |
+
</div>
|
| 26 |
+
<button class="md:hidden">
|
| 27 |
+
<i data-feather="menu" class="text-gray-600"></i>
|
| 28 |
+
</button>
|
| 29 |
+
</div>
|
| 30 |
+
</nav>
|
| 31 |
+
`;
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,75 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>jQuery Template Magic</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
| 12 |
+
<script src="https://cdn.jsdelivr.net/npm/jquery-templates@1.0.0/jquery.tmpl.min.js"></script>
|
| 13 |
+
</head>
|
| 14 |
+
<body class="bg-gray-100 min-h-screen">
|
| 15 |
+
<div class="container mx-auto px-4 py-12">
|
| 16 |
+
<header class="text-center mb-12">
|
| 17 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-2">jQuery Template Wizard</h1>
|
| 18 |
+
<p class="text-xl text-gray-600">Powerful templates with jQuery magic</p>
|
| 19 |
+
</header>
|
| 20 |
+
|
| 21 |
+
<div class="bg-white rounded-xl shadow-lg p-8 mb-8">
|
| 22 |
+
<h2 class="text-2xl font-semibold mb-6 text-gray-800">Simple Template Example</h2>
|
| 23 |
+
<div id="templateContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"></div>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<div class="bg-white rounded-xl shadow-lg p-8">
|
| 27 |
+
<h2 class="text-2xl font-semibold mb-6 text-gray-800">Dynamic Data Binding</h2>
|
| 28 |
+
<div id="dynamicDataContainer" class="grid grid-cols-1 md:grid-cols-2 gap-6"></div>
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<!-- Sample Template -->
|
| 33 |
+
<script id="simpleTemplate" type="text/x-jquery-tmpl">
|
| 34 |
+
<div class="bg-white border border-gray-200 rounded-lg p-6 shadow-sm hover:shadow-md transition-shadow duration-300">
|
| 35 |
+
<div class="flex items-center mb-4">
|
| 36 |
+
<div class="bg-blue-100 p-3 rounded-full mr-4">
|
| 37 |
+
<i data-feather="star" class="text-blue-500"></i>
|
| 38 |
+
</div>
|
| 39 |
+
<h3 class="text-xl font-medium text-gray-800">\${title}</h3>
|
| 40 |
+
</div>
|
| 41 |
+
<p class="text-gray-600 mb-4">\${description}</p>
|
| 42 |
+
<button class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors duration-300">
|
| 43 |
+
Learn more
|
| 44 |
+
</button>
|
| 45 |
+
</div>
|
| 46 |
+
</script>
|
| 47 |
+
|
| 48 |
+
<!-- Dynamic Data Template -->
|
| 49 |
+
<script id="dynamicTemplate" type="text/x-jquery-tmpl">
|
| 50 |
+
<div class="bg-gray-50 border border-gray-200 rounded-lg p-6">
|
| 51 |
+
<div class="flex items-start mb-4">
|
| 52 |
+
<div class="bg-green-100 p-3 rounded-full mr-4">
|
| 53 |
+
<i data-feather="user" class="text-green-500"></i>
|
| 54 |
+
</div>
|
| 55 |
+
<div>
|
| 56 |
+
<h3 class="text-lg font-medium text-gray-800">\${name}</h3>
|
| 57 |
+
<p class="text-gray-500 text-sm">\${role}</p>
|
| 58 |
+
</div>
|
| 59 |
+
</div>
|
| 60 |
+
<p class="text-gray-700 mb-4">\${bio}</p>
|
| 61 |
+
<div class="flex space-x-2">
|
| 62 |
+
{{each skills}}
|
| 63 |
+
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">\${$value}</span>
|
| 64 |
+
{{/each}}
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</script>
|
| 68 |
+
|
| 69 |
+
<script src="script.js"></script>
|
| 70 |
+
<script>
|
| 71 |
+
feather.replace();
|
| 72 |
+
</script>
|
| 73 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 74 |
+
</body>
|
| 75 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
$(document).ready(function() {
|
| 2 |
+
// Sample data for simple template
|
| 3 |
+
const simpleData = [
|
| 4 |
+
{
|
| 5 |
+
title: "Feature One",
|
| 6 |
+
description: "This is a description for feature one with some sample text."
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
title: "Feature Two",
|
| 10 |
+
description: "Another description here for the second feature card."
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
title: "Feature Three",
|
| 14 |
+
description: "Third feature with a slightly longer description text to show variation."
|
| 15 |
+
}
|
| 16 |
+
];
|
| 17 |
+
|
| 18 |
+
// Render simple template
|
| 19 |
+
$("#simpleTemplate").tmpl(simpleData).appendTo("#templateContainer");
|
| 20 |
+
|
| 21 |
+
// Sample data for dynamic template
|
| 22 |
+
const dynamicData = [
|
| 23 |
+
{
|
| 24 |
+
name: "John Doe",
|
| 25 |
+
role: "Frontend Developer",
|
| 26 |
+
bio: "Specializes in creating beautiful user interfaces with modern technologies.",
|
| 27 |
+
skills: ["JavaScript", "React", "Vue", "CSS"]
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
name: "Jane Smith",
|
| 31 |
+
role: "Backend Engineer",
|
| 32 |
+
bio: "Builds scalable server-side applications and APIs for various platforms.",
|
| 33 |
+
skills: ["Node.js", "Python", "SQL", "Docker"]
|
| 34 |
+
}
|
| 35 |
+
];
|
| 36 |
+
|
| 37 |
+
// Render dynamic template
|
| 38 |
+
$("#dynamicTemplate").tmpl(dynamicData).appendTo("#dynamicDataContainer");
|
| 39 |
+
|
| 40 |
+
// Add hover effect to all template items
|
| 41 |
+
$(".template-item").hover(
|
| 42 |
+
function() {
|
| 43 |
+
$(this).addClass("shadow-lg");
|
| 44 |
+
},
|
| 45 |
+
function() {
|
| 46 |
+
$(this).removeClass("shadow-lg");
|
| 47 |
+
}
|
| 48 |
+
);
|
| 49 |
+
});
|
style.css
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
margin-top: 0;
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 2 |
+
|
| 3 |
body {
|
| 4 |
+
font-family: 'Inter', sans-serif;
|
| 5 |
+
transition: all 0.3s ease;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
/* Custom animations */
|
| 9 |
+
@keyframes fadeIn {
|
| 10 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 11 |
+
to { opacity: 1; transform: translateY(0); }
|
| 12 |
}
|
| 13 |
|
| 14 |
+
.template-item {
|
| 15 |
+
animation: fadeIn 0.5s ease forwards;
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
+
/* Custom scrollbar */
|
| 19 |
+
::-webkit-scrollbar {
|
| 20 |
+
width: 8px;
|
| 21 |
+
height: 8px;
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
+
::-webkit-scrollbar-track {
|
| 25 |
+
background: #f1f1f1;
|
| 26 |
+
border-radius: 10px;
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
+
::-webkit-scrollbar-thumb {
|
| 30 |
+
background: #c1c1c1;
|
| 31 |
+
border-radius: 10px;
|
| 32 |
}
|
| 33 |
+
|
| 34 |
+
::-webkit-scrollbar-thumb:hover {
|
| 35 |
+
background: #a1a1a1;
|
| 36 |
+
}
|