Skip to content

Commit cf0e952

Browse files
committed
feat: genereate component
1 parent 4c40d78 commit cf0e952

File tree

14 files changed

+99
-210
lines changed

14 files changed

+99
-210
lines changed

app/components/Counter.vue

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/components/DarkToggle.vue

Lines changed: 0 additions & 21 deletions
This file was deleted.

app/components/Footer.vue

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/components/Generate.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<script lang="ts" setup>
2+
import { renderSVG } from 'uqr'
3+
4+
const props = withDefaults(defineProps<{
5+
data: string[]
6+
speed: number
7+
}>(), {
8+
speed: 250,
9+
})
10+
11+
const svgList = computed(() => props.data.map((content, i) => ({
12+
id: i,
13+
svg: renderSVG(content),
14+
})))
15+
const activeIndex = ref(0)
16+
watch(() => props.data, () => activeIndex.value = 0)
17+
const activeSvg = computed(() => svgList.value[activeIndex.value])
18+
19+
let intervalId: any
20+
function initInterval() {
21+
intervalId = setInterval(() => {
22+
activeIndex.value = (activeIndex.value + 1) % svgList.value.length
23+
}, props.speed)
24+
}
25+
watch(() => props.speed, () => {
26+
intervalId && clearInterval(intervalId)
27+
initInterval()
28+
}, { immediate: true })
29+
onUnmounted(() => intervalId && clearInterval(intervalId))
30+
</script>
31+
32+
<template>
33+
<div flex flex-col items-center>
34+
<p>{{ activeIndex }}/{{ svgList.length }}</p>
35+
<div class="h-full max-h-50vh max-w-50vh w-full" v-html="activeSvg?.svg" />
36+
</div>
37+
</template>

app/components/InputEntry.vue

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/components/Logos.vue

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/components/PageView.vue

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/layouts/default.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
<template>
2-
<main class="px-10 py-20 text-center">
3-
<slot />
4-
<Footer />
5-
<div class="mx-auto mt-5 text-center text-sm opacity-25">
6-
[Default Layout]
2+
<main>
3+
<div flex flex-col items-center gap-4 text-center>
4+
<h1 text-4xl>
5+
QR Code Generator
6+
</h1>
7+
<div flex gap-5>
8+
<NuxtLink op70 hover="text-blue" to="/" active-class="!op100">
9+
Generate
10+
</NuxtLink>
11+
<NuxtLink op70 hover="text-blue" to="/scan" active-class="!op100">
12+
Scan
13+
</NuxtLink>
14+
</div>
715
</div>
16+
<slot />
817
</main>
918
</template>

app/layouts/home.vue

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/pages/[...all].vue

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)