Skip to content

Commit 4aa33b2

Browse files
yuyinwsdanielroe
andauthored
feat: add icons in install command (#216)
Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent 7331083 commit 4aa33b2

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

app/pages/[...package].vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,14 +680,15 @@ defineOgImageComponent('Package', {
680680
:key="pm.id"
681681
role="tab"
682682
:aria-selected="selectedPM === pm.id"
683-
class="px-2 py-1 font-mono text-xs rounded transition-colors duration-150 border border-solid focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
683+
class="px-2 py-1 font-mono text-xs rounded transition-colors duration-150 border border-solid focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 inline-flex items-center gap-1.5"
684684
:class="
685685
selectedPM === pm.id
686686
? 'bg-bg shadow text-fg border-border'
687687
: 'text-fg-subtle hover:text-fg border-transparent'
688688
"
689689
@click="selectedPM = pm.id"
690690
>
691+
<span class="inline-block h-3 w-3" :class="pm.icon" aria-hidden="true" />
691692
{{ pm.label }}
692693
</button>
693694
<template #fallback>

app/utils/install-command.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
import type { JsrPackageInfo } from '#shared/types/jsr'
22

3+
// @unocss-include
34
export const packageManagers = [
4-
{ id: 'npm', label: 'npm', action: 'install', execute: 'npx' },
5-
{ id: 'pnpm', label: 'pnpm', action: 'add', execute: 'pnpm dlx' },
6-
{ id: 'yarn', label: 'yarn', action: 'add', execute: 'yarn dlx' },
7-
{ id: 'bun', label: 'bun', action: 'add', execute: 'bunx' },
8-
{ id: 'deno', label: 'deno', action: 'add', execute: 'deno run' },
9-
{ id: 'vlt', label: 'vlt', action: 'install', execute: 'vlt x' },
5+
{
6+
id: 'npm',
7+
label: 'npm',
8+
action: 'install',
9+
execute: 'npx',
10+
icon: 'i-simple-icons:npm',
11+
},
12+
{
13+
id: 'pnpm',
14+
label: 'pnpm',
15+
action: 'add',
16+
execute: 'pnpm dlx',
17+
icon: 'i-simple-icons:pnpm',
18+
},
19+
{
20+
id: 'yarn',
21+
label: 'yarn',
22+
action: 'add',
23+
execute: 'yarn dlx',
24+
icon: 'i-simple-icons:yarn',
25+
},
26+
{ id: 'bun', label: 'bun', action: 'add', execute: 'bunx', icon: 'i-simple-icons:bun' },
27+
{
28+
id: 'deno',
29+
label: 'deno',
30+
action: 'add',
31+
execute: 'deno run',
32+
icon: 'i-simple-icons:deno',
33+
},
34+
{ id: 'vlt', label: 'vlt', action: 'install', execute: 'vlt x', icon: 'i-custom-vlt' },
1035
] as const
1136

1237
export type PackageManagerId = (typeof packageManagers)[number]['id']

uno.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Theme } from '@unocss/preset-wind4/theme'
1010
const customIcons = {
1111
tangled:
1212
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25"><path fill="currentColor" d="M16.346 24.11c-.785-.007-1.384-.235-2.034-.632-.932-.49-1.643-1.314-2.152-2.222-.808 1.003-1.888 1.611-3.097 1.955-.515.15-1.416.301-2.911-.24-2.154-.724-3.723-2.965-3.545-5.25-.033-.946.313-1.875.802-2.674-1.305-.7-2.37-1.876-2.777-3.318-.248-.79-.237-1.64-.146-2.452.327-1.916 1.764-3.582 3.615-4.182.738-1.683 2.35-2.938 4.176-3.193a5.54 5.54 0 0 1 3.528.7C13.351.89 16.043.383 18.1 1.436c1.568.75 2.69 2.312 2.962 4.015 1.492.598 2.749 1.817 3.242 3.365.33.958.34 2.013.127 2.997-.382 1.536-1.465 2.842-2.868 3.557.003.273.901 2.243.751 3.73-.033 1.858-1.211 3.62-2.846 4.475-.954.557-2.085.546-3.12.535m-4.47-5.35c1.322-.148 2.19-1.3 2.862-2.339.319-.473.562-1.002.803-1.506.314.287.58.828 1.075.957.522.163 1.133.03 1.453-.443.611-1.14.31-2.517-.046-3.699-.22-.679-.507-1.375-1.054-1.856.116-.823-.372-1.66-1.065-2.09-.592.47-1.491.468-2.061-.037-1.093 1.115-2.095 1.078-3.063.195-.217-.199-.632 1.212-2.088.413-.837.7-1.485 1.375-2.06 2.346-.559 1.046-1.143 1.976-1.194 3.113-.024.664.495 1.36 1.198 1.306.703.063 1.182-.63 1.714-.917.08.928.169 1.924.482 2.829.36 1.171 1.627 1.916 2.825 1.745zm.687-3.498c-.644-.394-.334-1.25-.36-1.871.064-.75.115-1.538.453-2.221.356-.487 1.226-.3 1.265.326-.026.628-.314 1.254-.28 1.905-.075.544.054 1.155-.186 1.653-.198.275-.6.355-.892.208m-2.81-.358c-.605-.329-.413-1.156-.508-1.73.08-.666.014-1.51.571-1.978.545-.38 1.287.271 1.03.869-.276.755-.096 1.58-.09 2.346a.712.712 0 0 1-1.002.493"/></svg>',
13+
vlt: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.9991 5.03666C7.9991 5.46387 7.93211 5.87545 7.80808 6.26145C7.45933 7.34674 7.1975 8.58253 7.7669 9.57009L10.389 14.1177C10.7072 14.6697 11.3617 14.9108 11.9989 14.9108V14.9108V14.9108C12.6352 14.9108 13.2886 14.6699 13.6064 14.1187L16.2301 9.5682C16.7993 8.58097 16.5379 7.34565 16.1895 6.26064C16.0656 5.87488 15.9987 5.46358 15.9987 5.03666C15.9987 2.82777 17.7894 1.03711 19.9983 1.03711C22.2071 1.03711 23.9978 2.82777 23.9978 5.03666C23.9978 7.24555 22.2071 9.03621 19.9983 9.03621V9.03621C19.3609 9.03621 18.7062 9.27733 18.3878 9.82951L15.7661 14.3766C15.1967 15.3642 15.4586 16.6001 15.8074 17.6854C15.9314 18.0715 15.9984 18.4831 15.9984 18.9104C15.9984 21.1193 14.2078 22.9099 11.9989 22.9099C9.79001 22.9099 7.99935 21.1193 7.99935 18.9104C7.99935 18.4834 8.06626 18.072 8.19016 17.6862C8.53863 16.6012 8.80017 15.3657 8.23092 14.3785L5.60752 9.8285C5.28961 9.27712 4.63601 9.03621 3.99955 9.03621V9.03621C1.79066 9.03621 0 7.24555 0 5.03666C0 2.82777 1.79066 1.03711 3.99955 1.03711C6.20844 1.03711 7.9991 2.82777 7.9991 5.03666Z" fill="currentColor"></path></svg>',
1314
}
1415

1516
export default defineConfig({

0 commit comments

Comments
 (0)