Skip to content

Commit a7cebc1

Browse files
authoredNov 24, 2023
feat(devtools): new design (#115)
1 parent 1012888 commit a7cebc1

30 files changed

+743
-342
lines changed
 

‎.playground-minimal/app.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ defineOgImageCached({
99

1010
<template>
1111
<div>
12-
<img src="/__og_image__/og.png" width="1200" height="630">
12+
<img src="/__og-image__/image/og.png" width="1200" height="630">
1313
</div>
1414
</template>

‎.playground/components/OgImage/ArrayProp.vue

-14
This file was deleted.

‎.playground/components/OgImage/NuxtIcon.vue

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const containerStyles = {
1919

2020
<template>
2121
<div :style="containerStyles">
22+
<div>{{ title }}</div>
23+
<div>{{ description }}</div>
2224
<Icon name="uil:github" size="250px" style="margin: 0 auto;" />
2325
</div>
2426
</template>

‎.playground/nuxt.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export default defineNuxtConfig({
9191
},
9292

9393
site: {
94+
url: 'https://nuxtseo.com',
9495
name: 'OG Image Playground',
9596
},
9697

‎.playground/pages/index.vue

+5-46
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { computed, definePageMeta, onBeforeUnmount, onMounted, ref, useDebounceFn, useServerSeoMeta, watch } from '#imports'
2+
import { computed, definePageMeta, useServerSeoMeta } from '#imports'
33
44
definePageMeta({
55
title: 'Home',
@@ -8,57 +8,16 @@ definePageMeta({
88
})
99
1010
useServerSeoMeta({
11-
title: 'Home & //<"With Encoding">\\\\',
12-
ogTitle: 'Home & //<"With Encoding">\\\\',
11+
title: 'Welcome to the playground',
12+
ogTitle: 'Welcome to the playground',
1313
})
1414
1515
const host = computed(() => typeof window !== 'undefined' ? window.location.href : '/')
16-
17-
const color = ref('bg-green-500')
18-
const title = ref('Fully dynamic')
19-
20-
const time = ref('')
21-
22-
function setTime() {
23-
const date = new Date()
24-
const hours = date.getHours()
25-
const minutes = date.getMinutes()
26-
const seconds = date.getSeconds()
27-
// use am pm
28-
const ampm = hours >= 12 ? 'PM' : 'AM'
29-
const hours12 = hours % 12 || 12
30-
time.value = `${hours12}:${minutes < 10 ? `0${minutes}` : minutes}:${seconds < 10 ? `0${seconds}` : seconds} ${ampm}`
31-
}
32-
33-
setTime()
34-
35-
let interval = null
36-
onMounted(() => {
37-
interval = setInterval(() => {
38-
setTime()
39-
}, 15000)
40-
})
41-
42-
onBeforeUnmount(() => {
43-
clearInterval(interval)
44-
})
45-
46-
const tailwindUrl = ref(`${host.value}satori/tailwind/__og_image__/og.png?title=${encodeURIComponent(title.value)}&bgColor=${color.value.replace('#', '')}`)
47-
48-
const setTailwindUrl = useDebounceFn(() => {
49-
// do something
50-
tailwindUrl.value = `${host.value}satori/tailwind/__og_image__/og.png?title=${encodeURIComponent(title.value)}&bgColor=${color.value.replace('#', '')}`
51-
}, 500)
52-
53-
watch([color, title], () => {
54-
// do debounce
55-
setTailwindUrl()
56-
})
5716
</script>
5817

5918
<template>
6019
<div class="px-7 my-5">
61-
<OgImage description="My description of the home page." theme-color="#b5ffd6" />
62-
<img :src="`${host}satori/static/__og_image__/og.png`" width="400" height="210" class="rounded">
20+
<OgImage description="My description of the home page." />
21+
<img :src="`${host}__og-image__/image/satori/static/og.png`" width="400" height="210" class="rounded">
6322
</div>
6423
</template>

‎.playground/pages/satori/array-prop.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script setup lang="ts">
2-
defineOgImage({
2+
import ArrayProp from '~/components/OgImage/ArrayProp.vue'
3+
4+
defineOgImage(ArrayProp, {
35
component: 'ArrayProp',
46
list: [1, 2, 3],
57
})

‎.playground/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./.nuxt/tsconfig.json"
3+
}

0 commit comments

Comments
 (0)
Please sign in to comment.