Skip to content

Commit add4e7a

Browse files
committed
chore(playground): improve ui
1 parent b1dad71 commit add4e7a

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

playground/src/App.vue

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { transformJsxToString } from 'unplugin-jsx-string/api'
33
4-
const { copy } = useClipboard()
4+
const { copy, copied } = useClipboard()
55
66
const code = $ref(
77
`
@@ -33,41 +33,40 @@ const convert = () => {
3333
}
3434
}
3535
36-
const copyOutput = async () => {
37-
await copy(result)
38-
// eslint-disable-next-line no-alert
39-
alert('Copied!')
40-
}
36+
const copyOutput = () => copy(result)
4137
4238
watch($$(code), () => convert(), { immediate: true })
4339
</script>
4440

4541
<template>
46-
<main font-sans p="x-4 y-10" text="center gray-700 dark:gray-200">
42+
<main
43+
font-sans
44+
py10
45+
text="gray-700 dark:gray-200"
46+
flex="~ col"
47+
items-center
48+
gap4
49+
>
4750
<app-header />
48-
49-
<div py-4 />
50-
5151
<code-input v-model="code" placeholder="Paste your code" />
5252

53-
<div py-4>Output</div>
54-
55-
<code-input :model-value="result" readonly />
56-
57-
<div>
53+
<div flex gap2 items-center>
54+
Output
5855
<button
5956
text-sm
60-
btn
61-
flex="inline gap-1"
62-
items-center
57+
rounded
58+
hover="bg-active"
59+
p2
6360
:disabled="!code"
6461
@click="copyOutput"
6562
>
66-
<div i-carbon-copy inline-block />
67-
Copy
63+
<div
64+
:class="copied ? 'i-carbon:checkmark text-green' : 'i-carbon-copy'"
65+
/>
6866
</button>
6967
</div>
7068

69+
<code-input :model-value="result" readonly />
7170
<app-footer />
7271
</main>
7372
</template>

playground/uno.config.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@ import {
77
} from 'unocss'
88

99
export default defineConfig({
10-
shortcuts: [
11-
[
12-
'btn',
13-
'px-4 py-1 rounded inline-block bg-teal-600 text-white cursor-pointer hover:bg-teal-700 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50',
14-
],
15-
[
16-
'icon-btn',
17-
'text-[0.9em] inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600',
18-
],
19-
],
10+
shortcuts: {
11+
'bg-active': 'bg-#8881',
12+
},
2013
presets: [
2114
presetWind3(),
2215
presetAttributify(),

0 commit comments

Comments
 (0)