-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.vue
More file actions
203 lines (196 loc) · 6.82 KB
/
Copy pathApp.vue
File metadata and controls
203 lines (196 loc) · 6.82 KB
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
<script setup lang="ts">
import { debug } from '@vingy/vuebugger'
import { ref } from 'vue'
import DialogDemo from './DialogDemo.vue'
import MyComponent from './MyComponent.vue'
const count = ref(0)
debug('foobar', { count })
</script>
<template>
<div class="min-h-screen bg-slate-950 text-slate-100">
<div class="mx-auto max-w-5xl space-y-10 px-6 py-12">
<header class="space-y-3">
<div
class="inline-flex items-center gap-2 rounded-full border border-slate-800 bg-slate-900/70 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-slate-300"
>
Vue Utilities Demo
</div>
<h1
class="text-4xl font-bold tracking-tight text-white sm:text-5xl"
>
You did it!
</h1>
<p
class="max-w-2xl text-base text-slate-300 sm:text-lg"
>
Try out Vuebugger and Vueltip with a simple
counter, dynamic components, and tooltips.
</p>
</header>
<section
class="rounded-2xl border border-slate-800 bg-slate-900/60 p-6 shadow-lg"
>
<div class="mb-6 flex items-center justify-between">
<div>
<h2 class="text-lg font-semibold text-white">
Vuebugger
</h2>
<p class="text-sm text-slate-400">
Check the Vue devtools panel for live state.
</p>
</div>
<span
class="rounded-full bg-slate-800 px-3 py-1 text-xs font-medium text-slate-300"
>
Total: {{ count }}
</span>
</div>
<div class="space-y-6">
<div
class="flex flex-wrap items-center justify-between gap-4 rounded-xl border border-slate-800 bg-slate-900/40 p-4"
>
<div>
<h3 class="text-sm font-semibold text-white">
Counter
</h3>
<p class="text-xs text-slate-400">
Manage items and see live updates.
</p>
</div>
<div class="flex items-center gap-3">
<button
v-tooltip="'Add one item'"
class="inline-flex items-center gap-2 rounded-lg bg-gradient-to-r from-sky-500 to-indigo-500 px-4 py-2 text-sm font-semibold text-white shadow-lg shadow-sky-500/20 transition hover:from-sky-400 hover:to-indigo-400"
@click="count++"
>
Add
</button>
<button
v-tooltip="{
text: 'Remove one item',
placement: 'right',
}"
class="inline-flex items-center gap-2 rounded-lg border border-rose-500/60 bg-rose-500/10 px-4 py-2 text-sm font-semibold text-rose-200 transition hover:bg-rose-500/20"
@click="count--"
>
Remove
</button>
</div>
</div>
<div>
<div
class="mb-3 flex items-center justify-between"
>
<h3 class="text-sm font-semibold text-white">
Dynamic Components
</h3>
</div>
<div
v-if="count === 0"
class="rounded-lg border border-dashed border-slate-700 bg-slate-900/40 px-4 py-6 text-center text-sm text-slate-400"
>
Add some items to see them below...
</div>
<div class="grid gap-3 sm:grid-cols-2">
<MyComponent
v-for="n in count"
:key="n"
:label="String(n)"
/>
</div>
</div>
</div>
</section>
<section
class="rounded-2xl border border-slate-800 bg-slate-900/60 p-6 shadow-lg"
>
<h2 class="mb-4 text-lg font-semibold text-white">
Vueltip in Dialog
</h2>
<p class="mb-4 text-sm text-slate-400">
Tooltips work seamlessly inside dialog elements.
</p>
<DialogDemo />
</section>
<section
class="rounded-2xl border border-slate-800 bg-slate-900/60 p-6 shadow-lg"
>
<h2 class="mb-4 text-lg font-semibold text-white">
Vueltip
</h2>
<div class="grid gap-4 sm:grid-cols-2">
<p
v-tooltip="'Simple text tooltip'"
class="rounded-xl border border-slate-700 bg-slate-900/70 px-4 py-3 text-sm text-slate-200 shadow-sm transition hover:border-slate-500"
>
Hover over me (top)
</p>
<p
v-tooltip="{
text: 'Bottom placement',
placement: 'bottom',
}"
class="rounded-xl border border-slate-700 bg-slate-900/70 px-4 py-3 text-sm text-slate-200 shadow-sm transition hover:border-slate-500"
>
Hover over me (bottom)
</p>
<p
v-tooltip="{
text: 'Left placement',
placement: 'left',
}"
class="rounded-xl border border-slate-700 bg-slate-900/70 px-4 py-3 text-sm text-slate-200 shadow-sm transition hover:border-slate-500"
>
Hover over me (left)
</p>
<p
v-tooltip="{
text: 'Right placement',
placement: 'right',
}"
class="rounded-xl border border-slate-700 bg-slate-900/70 px-4 py-3 text-sm text-slate-200 shadow-sm transition hover:border-slate-500"
>
Hover over me (right)
</p>
<p
v-tooltip="{
text: 'Custom data: ',
custom: { sum: 23 },
}"
class="rounded-xl border border-slate-700 bg-slate-900/70 px-4 py-3 text-sm text-slate-200 shadow-sm transition hover:border-slate-500"
>
Hover over me (custom data)
</p>
</div>
<div class="mt-6 space-y-3">
<div>
<h3 class="text-sm font-semibold text-white">
Truncation-only tooltip
</h3>
<p class="text-xs text-slate-400">
Resize the container: tooltip only appears
when the text is truncated.
</p>
</div>
<div
class="relative inline-block w-80 min-w-[12rem] max-w-full overflow-auto rounded-xl border border-dashed border-slate-700 bg-slate-900/50 p-3"
style="resize: horizontal"
>
<p
v-tooltip="
'This is a long line of text that only shows a tooltip when it gets truncated.'
"
class="truncate text-sm text-slate-200"
>
This is a long line of text that only shows a
tooltip when it gets truncated.
</p>
</div>
</div>
</section>
</div>
</div>
</template>
<style>
@import 'tailwindcss';
</style>