-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
69 lines (57 loc) · 2.68 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="a fast, simple textarea that just works">
<meta name="author" content="GJ Tiquia">
<!-- Prevent flash of wrong theme -->
<script>
// Check localStorage first
const darkMode = localStorage.getItem('darkMode');
if (darkMode === 'dark' || (darkMode === null && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
}
</script>
<link rel="stylesheet" href="src/style.css">
<script type="module" src="src/main.ts"></script>
<title>mini textarea</title>
</head>
<body class="h-dvh p-4 pb-2 flex flex-col items-center bg-white dark:bg-stone-900 dark:text-white">
<h1 class="font-bold text-3xl">
mini <code><textarea/></code>
</h1>
<h2 class="pb-4">
a fast, simple <code><textarea/></code> that <span id="shortcuts-tooltip" class="border-b border-dotted cursor-help">just works</span>
</h2>
<textarea spellcheck="false" class="
flex-grow w-full max-w-screen-md
border-2 border-stone-500
rounded-md
resize-none
p-1
bg-white dark:bg-stone-900
text-black dark:text-white
"></textarea>
<div class="w-full max-w-screen-md pt-2 flex justify-between items-center">
<a href="https://github.com/gjtiquia/mini-textarea" target="_blank"
class="text-blue-500 hover:text-blue-600 active:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 dark:active:text-blue-500 underline">github source code</a>
<button onclick="toggleDarkMode()" class="p-2 rounded-lg hover:bg-stone-100 dark:hover:bg-stone-800/50">
<svg class="w-6 h-6 hidden dark:block" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
</svg>
<svg class="w-6 h-6 block dark:hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
</svg>
</button>
</div>
<script>
function toggleDarkMode() {
document.documentElement.classList.toggle('dark');
// Save preference to localStorage
const isDark = document.documentElement.classList.contains('dark');
localStorage.setItem('darkMode', isDark ? 'dark' : 'light');
}
</script>
</body>
</html>