@@ -17,132 +17,8 @@ const props = withDefaults(
1717 },
1818)
1919console .log (' blog post 2' , props )
20-
21- const formattedDate = computed (() => {
22- console .log (' blog post 3' , props .date )
23- if (! props .date ) return ' '
24- try {
25- return new Date (props .date ).toLocaleDateString (' en-US' , {
26- year: ' numeric' ,
27- month: ' short' ,
28- day: ' numeric' ,
29- })
30- } catch {
31- console .log (' blog post 4' , props .date )
32- return props .date
33- }
34- })
35-
36- const MAX_VISIBLE_AUTHORS = 2
37-
38- const getInitials = (name : string ) =>
39- name
40- .split (' ' )
41- .map (n => n [0 ])
42- .join (' ' )
43- .toUpperCase ()
44- .slice (0 , 2 )
45-
46- const visibleAuthors = computed (() => {
47- console .log (' blog post 5' , props .authors )
48- if (props .authors .length <= 3 ) return props .authors
49- return props .authors .slice (0 , MAX_VISIBLE_AUTHORS )
50- })
51-
52- const extraCount = computed (() => {
53- console .log (' blog post 6' , props .authors )
54- if (props .authors .length <= 3 ) return 0
55- return props .authors .length - MAX_VISIBLE_AUTHORS
56- })
57-
58- const formattedAuthorNames = computed (() => {
59- console .log (' blog post 7' , props .authors )
60- const allNames = props .authors .map (a => a .name )
61- if (allNames .length === 0 ) return ' '
62- if (allNames .length === 1 ) return allNames [0 ]
63- if (allNames .length === 2 ) return ` ${allNames [0 ]} and ${allNames [1 ]} `
64- if (allNames .length === 3 ) return ` ${allNames [0 ]}, ${allNames [1 ]}, and ${allNames [2 ]} `
65- // More than 3: show first 2 + others
66- const shown = allNames .slice (0 , MAX_VISIBLE_AUTHORS )
67- const remaining = allNames .length - MAX_VISIBLE_AUTHORS
68- return ` ${shown .join (' , ' )} and ${remaining } others `
69- })
7020 </script >
7121
7222<template >
73- <div
74- class =" h-full w-full flex flex-col justify-center px-20 bg-[#050505] text-[#fafafa] relative overflow-hidden"
75- >
76- <!-- npmx logo - top right -->
77- <div
78- class =" absolute top-12 z-10 flex items-center gap-1 text-5xl font-bold tracking-tight"
79- style =" font-family : ' Geist' , sans-serif ; right : 6rem "
80- >
81- <span :style =" { color: primaryColor }" class =" opacity-80" >./</span >
82- <span class =" text-white" >npmx</span >
83- </div >
84-
85- <div class =" relative z-10 flex flex-col gap-2" >
86- <!-- Date -->
87- <span
88- v-if =" formattedDate"
89- class =" text-3xl text-[#a3a3a3] font-light"
90- style =" font-family : ' Geist' , sans-serif "
91- >
92- {{ formattedDate }}
93- </span >
94-
95- <!-- Blog title -->
96- <h1
97- class =" text-6xl font-semibold tracking-tight leading-snug w-9/10"
98- style =" font-family : ' Geist' , sans-serif ; letter-spacing : -0.03em "
99- >
100- {{ title }}
101- </h1 >
102-
103- <!-- Authors -->
104- <div
105- v-if =" authors.length"
106- class =" flex items-center gap-4 self-start justify-start flex-nowrap"
107- style =" font-family : ' Geist' , sans-serif "
108- >
109- <!-- Stacked avatars -->
110- <span >
111- <span
112- v-for =" (author, index) in visibleAuthors"
113- :key =" author.name"
114- class =" flex items-center justify-center rounded-full border border-[#050505] bg-[#1a1a1a] overflow-hidden w-12 h-12"
115- :style =" { marginLeft: index > 0 ? '-20px' : '0' }"
116- >
117- <img
118- v-if =" author.avatar"
119- :src =" author.avatar"
120- :alt =" author.name"
121- class =" w-full h-full object-cover"
122- />
123- <span v-else style =" font-size : 20px ; color : #666 ; font-weight : 500 " >
124- {{ getInitials(author.name) }}
125- </span >
126- </span >
127- <!-- +N badge -->
128- <span
129- v-if =" extraCount > 0"
130- class =" flex items-center justify-center text-lg font-medium text-[#a3a3a3] rounded-full border border-[#050505] bg-[#262626] overflow-hidden w-12 h-12"
131- :style =" { marginLeft: '-20px' }"
132- >
133- +{{ extraCount }}
134- </span >
135- </span >
136- <!-- Names -->
137- <span style =" font-size : 24px ; color : #a3a3a3 ; font-weight : 300 " >{{
138- formattedAuthorNames
139- }}</span >
140- </div >
141- </div >
142-
143- <div
144- class =" absolute -top-32 -inset-ie-32 w-[550px] h-[550px] rounded-full blur-3xl"
145- :style =" { backgroundColor: primaryColor + '10' }"
146- />
147- </div >
23+ <div >Test</div >
14824</template >
0 commit comments