-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcard-generator.html
207 lines (194 loc) · 7.86 KB
/
card-generator.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TailorWind</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="main.css">
</head>
<body class="bg-gray-100 min-h-screen flex flex-col">
<!-- Navbar -->
<header class="bg-white shadow p-4 flex justify-between items-center px-10">
<div class="flex items-center space-x-2">
<div class="w-10 h-10 rounded">
<img src="/Logo.png" alt="Tailwind Generator Logo" />
</div>
<span class="font-bold text-xl text-gray-800">TailorWind</span>
<!-- Add Dark Mode Toggle Button -->
<button id="darkModeToggle" class="ml-4 relative w-8 h-8 flex items-center justify-center">
<i class="fas fa-sun text-xl text-[#ffbc00] absolute" id="lightIcon"></i>
<i class="fas fa-moon text-xl text-[#ffbc00] absolute hidden" id="darkIcon"></i>
</button>
</div>
<nav class="space-x-4">
<a href="/index.html" class="text-black hover:text-[#049b9f]">Home</a>
<a href="/tools-and-generator" class="text-black hover:text-[#049b9f]"
>Tools & Generator</a
>
<a href="/index.html" class="text-black hover:text-[#049b9f]">FAQ</a>
<a href="/index.html" class="text-black hover:text-[#049b9f]">Blog</a>
</nav>
<button class="bg-[#049b9f] text-white px-4 py-2 rounded">
Get started
</button>
</header>
<div class="flex flex-1">
<!-- Sidebar -->
<aside class="w-64 bg-white p-6 border-r">
<h2 class="text-lg font-semibold mb-4">Layout</h2>
<label class="block mb-2"
>Width:
<input
type="range"
min="300"
max="800"
step="50"
value="500"
id="cardWidth"
class="w-full"
/>
</label>
<h2 class="text-lg font-semibold mt-6 mb-4">Settings</h2>
<div class="space-y-2">
<label
><input type="checkbox" id="roundedCorners" checked /> Rounded
Corners</label
><br />
<label
><input type="checkbox" id="useImage" checked /> Use Image</label
><br />
<label
><input type="checkbox" id="useFooter" checked /> Use Footer</label
><br />
<label><input type="checkbox" id="centerText" /> Center Text</label>
</div>
<h2 class="text-lg font-semibold mt-6 mb-4">Card Styling</h2>
<label class="block mb-2"
>Card Background:
<input type="color" id="cardBackground" value="#ffffff" />
</label>
<label class="block mb-2"
>Card Title:
<input type="color" id="cardTitleColor" value="#374151" />
</label>
<label class="block mb-2"
>Card Content:
<input type="color" id="cardContentColor" value="#374151" />
</label>
<h2 class="text-lg font-semibold mt-6 mb-4">Button</h2>
<label class="block mb-2"
>Text Color:
<input type="color" id="buttonTextColor" value="#ffffff" />
</label>
<label class="block mb-2"
>Background Color:
<input type="color" id="buttonBackgroundColor" value="#049b9f" />
</label>
<button
id="exportCode"
class="mt-4 bg-blue-600 text-white px-4 py-2 rounded w-full"
>
Export HTML + Tailwind
</button>
</aside>
<!-- Card Preview -->
<main class="flex-1 p-10 flex justify-center items-center">
<div id="card" class="bg-white rounded-lg shadow w-[500px] p-6">
<div
id="cardImage"
class="bg-gray-800 w-full h-32 rounded-t-lg flex items-center justify-center"
>
<div
class="w-12 h-12 bg-gradient-to-r from-teal-100 to-teal-500 rounded"
></div>
</div>
<h3 id="cardTitle" class="mt-4 text-xl font-bold text-gray-800"></h3>
<p id="cardContent" class="mt-2 text-gray-600"></p>
<button
id="cardButton"
class="mt-4 bg-[#049b9f] text-white px-4 py-2 rounded w-full"
></button>
<div id="cardFooter" class="mt-4 text-gray-500 text-sm"></div>
</div>
</main>
<aside class="w-64 bg-white p-6 border-l">
<h2 class="text-lg font-semibold mb-4">Content</h2>
<label class="block mb-2"
>Card Title:
<input
type="text"
id="cardTitleInput"
value="Generator"
class="w-full border border-gray-300 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-[#049b9f]"
/>
</label>
<label class="block mb-2"
>Card Content:
<input
type="text"
id="cardContentInput"
value="Leverage a graphical editor to create, design and customize beautiful web components."
class="w-full border border-gray-300 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-[#049b9f]"
/>
</label>
<label class="block mb-2"
>Button Text:
<input
type="text"
id="cardButtonInput"
value="Try it out!"
class="w-full border border-gray-300 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-[#049b9f]"
/>
</label>
<label class="block mb-2"
>Footer:
<input
type="text"
id="cardFooterInput"
value="Footer content here..."
class="w-full border border-gray-300 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-[#049b9f]"
/>
</label>
</aside>
</div>
<script src="scripts/card-generator.js"></script>
<script>
// Dark mode implementation
document.addEventListener('DOMContentLoaded', () => {
const darkModeToggle = document.getElementById('darkModeToggle');
const lightIcon = document.getElementById('lightIcon');
const darkIcon = document.getElementById('darkIcon');
// Check for saved dark mode preference without animation
if (localStorage.getItem('darkMode') === 'enabled') {
document.documentElement.classList.add('dark');
lightIcon.classList.add('hidden');
darkIcon.classList.remove('hidden');
darkIcon.style.transform = 'rotate(0) scale(1)';
lightIcon.style.transform = 'rotate(0) scale(1)';
}
// Add transition classes after initial load
setTimeout(() => {
document.documentElement.classList.add('transition-colors', 'duration-500');
lightIcon.style.transition = 'all 0.3s ease-in-out';
darkIcon.style.transition = 'all 0.3s ease-in-out';
}, 100);
darkModeToggle.addEventListener('click', () => {
// Only animate on click
lightIcon.style.transform = 'rotate(180deg) scale(0.5)';
darkIcon.style.transform = 'rotate(180deg) scale(0.5)';
setTimeout(() => {
document.documentElement.classList.toggle('dark');
lightIcon.classList.toggle('hidden');
darkIcon.classList.toggle('hidden');
lightIcon.style.transform = 'rotate(0) scale(1)';
darkIcon.style.transform = 'rotate(0) scale(1)';
localStorage.setItem('darkMode',
document.documentElement.classList.contains('dark') ? 'enabled' : 'disabled'
);
}, 150);
});
});
</script>
</body>
</html>