11<script setup lang="ts">
2- import { ref , computed } from " vue" ;
3- import { VueUiSparkline } from " vue-data-ui/vue-ui-sparkline"
2+ import { VueUiSparkline } from ' vue-data-ui/vue-ui-sparkline'
43
54const props = defineProps <{
6- downloads? : Array <{
7- downloads: number | null ,
8- weekStart: string ,
9- weekEnd: string
10- }>
5+ downloads? : Array <{
6+ downloads: number | null
7+ weekStart: string
8+ weekEnd: string
9+ }>
1110}>()
1211
13- const dataset = computed (() => props .downloads ?.map (d => ({
12+ const dataset = computed (() =>
13+ props .downloads ?.map (d => ({
1414 value: d ?.downloads ?? 0 ,
15- period: ` ${d .weekStart ?? ' -' } to ${d .weekEnd ?? ' -' } `
16- })));
15+ period: ` ${d .weekStart ?? ' -' } to ${d .weekEnd ?? ' -' } ` ,
16+ })),
17+ )
1718
1819const lastDatapoint = computed (() => {
19- return (dataset .value || []).at (- 1 )?.period ?? ' '
20+ return (dataset .value || []).at (- 1 )?.period ?? ' '
2021})
2122
2223const config = computed (() => ({
23- theme: ' dark' , // enforced dark mode for now
24- style: {
25- backgroundColor: ' transparent' ,
26- area: {
27- color: ' #6A6A6A' ,
28- useGradient: false ,
29- opacity: 10
30- },
31- dataLabel: {
32- offsetX: - 10 ,
33- fontSize: 28 ,
34- bold: false ,
35- color: ' #FAFAFA'
36- },
37- line: {
38- color: ' #6A6A6A'
39- },
40- plot: {
41- radius: 6 ,
42- stroke: ' #FAFAFA'
43- },
44- title: {
45- text: lastDatapoint .value ,
46- fontSize: 12 ,
47- color: ' #666666' ,
48- bold: false ,
49- },
50- verticalIndicator: {
51- strokeDasharray: 0 ,
52- color: ' #FAFAFA'
53- }
54- }
24+ theme: ' dark' , // enforced dark mode for now
25+ style: {
26+ backgroundColor: ' transparent' ,
27+ area: {
28+ color: ' #6A6A6A' ,
29+ useGradient: false ,
30+ opacity: 10 ,
31+ },
32+ dataLabel: {
33+ offsetX: - 10 ,
34+ fontSize: 28 ,
35+ bold: false ,
36+ color: ' #FAFAFA' ,
37+ },
38+ line: {
39+ color: ' #6A6A6A' ,
40+ },
41+ plot: {
42+ radius: 6 ,
43+ stroke: ' #FAFAFA' ,
44+ },
45+ title: {
46+ text: lastDatapoint .value ,
47+ fontSize: 12 ,
48+ color: ' #666666' ,
49+ bold: false ,
50+ },
51+ verticalIndicator: {
52+ strokeDasharray: 0 ,
53+ color: ' #FAFAFA' ,
54+ },
55+ },
5556}))
56-
5757 </script >
5858
5959<template >
60- <div class =" space-y-8" >
61- <!-- Download stats -->
62- <section >
63- <div class =" flex items-center justify-between mb-3" >
64- <h2
65- id =" dependencies-heading"
66- class =" text-xs text-fg-subtle uppercase tracking-wider"
67- >
68- Weekly Downloads
69- </h2 >
70- </div >
71- <div class =" w-full" >
72- <ClientOnly >
73- <VueUiSparkline
74- :dataset
75- :config
76- />
77- </ClientOnly >
78- </div >
79- </section >
80- </div >
60+ <div class =" space-y-8" >
61+ <!-- Download stats -->
62+ <section >
63+ <div class =" flex items-center justify-between mb-3" >
64+ <h2 id =" dependencies-heading" class =" text-xs text-fg-subtle uppercase tracking-wider" >
65+ Weekly Downloads
66+ </h2 >
67+ </div >
68+ <div class =" w-full" >
69+ <ClientOnly >
70+ <VueUiSparkline :dataset :config />
71+ </ClientOnly >
72+ </div >
73+ </section >
74+ </div >
8175</template >
8276
8377<style >
8478/* * Overrides */
8579.vue-ui-sparkline-title span {
86- padding : 0 !important ;
87- letter-spacing : 0.04rem ;
80+ padding : 0 !important ;
81+ letter-spacing : 0.04rem ;
8882}
8983.vue-ui-sparkline text {
90- font-family : Geist Mono, monospace !important ;
84+ font-family :
85+ Geist Mono,
86+ monospace !important ;
9187}
92- </style >
88+ </style >
0 commit comments