-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.vue
70 lines (65 loc) · 2.12 KB
/
index.vue
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
<script setup>
const { data } = await useFetch("/api/frameworks");
const {
data: { frameworks, city },
} = data.value;
const formatNumber = (val) =>
new Intl.NumberFormat("en-US", { maximumSignificantDigits: 3 }).format(val);
</script>
<template>
<h1 class="text-2xl font-bold text-center">Top Web Frameworks</h1>
<p id="city-name" class="text-center text-gray-400 italic">{{ city }}</p>
<div class="overflow-x-auto rounded-lg border border-gray-200">
<table class="min-w-full divide-y-2 divide-gray-200 text-sm">
<caption class="py-2">
The list of top web frameworks
</caption>
<thead>
<tr>
<th
class="whitespace-nowrap px-4 py-2 text-left font-medium text-gray-900"
>
Name
</th>
<th
class="whitespace-nowrap px-4 py-2 text-left font-medium text-gray-900"
>
Language
</th>
<th
class="whitespace-nowrap px-4 py-2 text-left font-medium text-gray-900"
>
GitHub Stars
</th>
<th
class="whitespace-nowrap px-4 py-2 text-left font-medium text-gray-900"
>
Repo
</th>
</tr>
</thead>
<tbody v-if="frameworks" class="divide-y divide-gray-200">
<tr v-for="(framework, key) of frameworks" :key="key">
<td class="whitespace-nowrap px-4 py-2 font-medium text-gray-900">
{{ framework.name }}
</td>
<td class="whitespace-nowrap px-4 py-2 text-gray-700">
{{ framework.language }}
</td>
<td class="whitespace-nowrap px-4 py-2 text-gray-700">
{{ formatNumber(framework.stars) }} ⭐️
</td>
<td class="whitespace-nowrap px-4 py-2 text-gray-700">
<a
:href="framework.url"
title="GitHub link"
target="_blank"
class="p-1 text-center px-2 bg-blue-600 hover:bg-blue-700 text-white hover:text-white rounded-md"
>Visit</a
>
</td>
</tr>
</tbody>
</table>
</div>
</template>