File tree Expand file tree Collapse file tree 1 file changed +11
-19
lines changed
apps/svelte.dev/src/routes/packages Expand file tree Collapse file tree 1 file changed +11
-19
lines changed Original file line number Diff line number Diff line change 17
17
hour: ' numeric' ,
18
18
minute: ' numeric'
19
19
});
20
+
21
+ const href = $derived (pkg .homepage || pkg .repo_url || ` https://npmjs.org/package/${pkg .name } ` );
20
22
</script >
21
23
22
24
<article >
23
- {#snippet contents ()}
25
+ <a
26
+ class =" contents"
27
+ {href }
28
+ target ={href .startsWith (' /' ) ? null : ' _blank' }
29
+ rel =" noreferrer"
30
+ aria-label =" View project homepage"
31
+ onclick ={(e ) => e .stopPropagation ()}
32
+ >
24
33
<header >
25
34
<h3 >
26
35
{#if pkg .official }
58
67
59
68
<span style =" flex: 1 1 auto" ></span >
60
69
</p >
61
- {/ snippet }
62
-
63
- {#if pkg .homepage }
64
- <a
65
- class =" contents"
66
- href ={pkg .homepage }
67
- target ={pkg .homepage .startsWith (' /' ) ? null : ' _blank' }
68
- rel =" noreferrer"
69
- aria-label =" View project homepage"
70
- onclick ={(e ) => e .stopPropagation ()}
71
- >
72
- {@render contents ()}
73
- </a >
74
- {:else }
75
- <div class =" contents" >
76
- {@render contents ()}
77
- </div >
78
- {/if }
70
+ </a >
79
71
80
72
<!-- this is a sibling element so that we don't have links inside links -->
81
73
<div class =" links" >
You can’t perform that action at this time.
0 commit comments