|
30 | 30 | <!--************ UPDATES ************--> |
31 | 31 | <div class="col-span-1 xl:col-span-3 space-y-10"> |
32 | 32 | <div class="text-sm" v-if="loading">Loading updates...</div> |
33 | | - <div |
34 | | - v-for="update of updates" |
35 | | - :key="update.key" |
36 | | - class="space-y-6 border-b border-white/10 pb-6" |
37 | | - > |
38 | | - <div class="space-y-2"> |
39 | | - <div class="pb-2"> |
40 | | - <NuxtImg |
41 | | - format="webp" |
42 | | - loading="lazy" |
43 | | - v-if="update.props.image" |
44 | | - :src="update.props.image" |
45 | | - :alt="update.props.title" |
46 | | - class="w-96 h-auto rounded-xl" |
47 | | - /> |
| 33 | + <div class="text-sm text-neutral-400" v-else-if="!updates.length"> |
| 34 | + No updates are available right now. |
| 35 | + </div> |
| 36 | + <template v-else> |
| 37 | + <div |
| 38 | + v-for="update of updates" |
| 39 | + :key="update.key" |
| 40 | + class="space-y-6 border-b border-white/10 pb-6" |
| 41 | + > |
| 42 | + <div class="space-y-2"> |
| 43 | + <div class="pb-2"> |
| 44 | + <NuxtImg |
| 45 | + format="webp" |
| 46 | + loading="lazy" |
| 47 | + v-if="update.props.image" |
| 48 | + :src="update.props.image" |
| 49 | + :alt="update.props.title" |
| 50 | + class="w-96 h-auto rounded-xl" |
| 51 | + /> |
| 52 | + </div> |
| 53 | + <h3 class="text-3xl font-semibold">{{ update.props.title }}</h3> |
| 54 | + <p class="text-sky-500 text-sm"> |
| 55 | + {{ new Date(update.props.published).toDateString() }} |
| 56 | + </p> |
48 | 57 | </div> |
49 | | - <h3 class="text-3xl font-semibold">{{ update.props.title }}</h3> |
50 | | - <p class="text-sky-500 text-sm"> |
51 | | - {{ new Date(update.props.published).toDateString() }} |
52 | | - </p> |
53 | | - </div> |
54 | 58 |
|
55 | | - <div class="prose prose-lg prose-invert" v-html="$md.render(update.props.content || '')"></div> |
56 | | - </div> |
| 59 | + <div class="prose prose-lg prose-invert" v-html="$md.render(update.props.content || '')"></div> |
| 60 | + </div> |
| 61 | + </template> |
57 | 62 | </div> |
58 | 63 | </div> |
59 | 64 | </section> |
60 | 65 | </template> |
61 | 66 |
|
62 | 67 | <script> |
63 | 68 | export default { |
64 | | - async created() { |
65 | | - this.loading = true |
66 | | - const data = await fetch('https://release-notes.cyclic.app/api/posts') |
67 | | - .then(res => res.json()) |
68 | | - |
69 | | - this.updates = data |
70 | | - this.loading = false |
71 | | - }, |
72 | | -
|
73 | 69 | data() { |
74 | 70 | return { |
75 | 71 | updates: [], |
|
0 commit comments