Skip to content

Commit a5b2e9c

Browse files
refactor: use buttons and links components in account menu (#1451)
1 parent 307c21c commit a5b2e9c

File tree

5 files changed

+36
-59
lines changed

5 files changed

+36
-59
lines changed

app/components/AppHeader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const mobileLinks = computed<NavigationConfigWithGroups>(() => [
107107
target: '_blank',
108108
type: 'link',
109109
external: true,
110-
iconClass: 'i-simple-icons:bluesky',
110+
iconClass: 'i-carbon:logo-bluesky',
111111
},
112112
{
113113
name: 'Chat',

app/components/CallToAction.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const socialLinks = computed(() => [
1919
{
2020
id: 'bluesky',
2121
href: 'https://social.npmx.dev',
22-
icon: 'i-simple-icons:bluesky',
22+
icon: 'i-carbon:logo-bluesky',
2323
titleKey: $t('about.get_involved.follow.title'),
2424
descriptionKey: $t('about.get_involved.follow.description'),
2525
ctaKey: $t('about.get_involved.follow.cta'),

app/components/Header/AccountMenu.client.vue

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ function openAuthModal() {
142142
<!-- Connected accounts section -->
143143
<div v-if="hasAnyConnection" class="py-1">
144144
<!-- npm CLI connection -->
145-
<button
145+
<ButtonBase
146146
v-if="isNpmConnected && npmUser"
147-
type="button"
148147
role="menuitem"
149-
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"
148+
class="w-full text-start gap-x-3 border-none"
150149
@click="openConnectorModal"
150+
out
151151
>
152152
<img
153153
v-if="npmAvatar"
@@ -182,14 +182,13 @@ function openAuthModal() {
182182
})
183183
}}
184184
</span>
185-
</button>
185+
</ButtonBase>
186186

187187
<!-- Atmosphere connection -->
188-
<button
188+
<ButtonBase
189189
v-if="atprotoUser"
190-
type="button"
191190
role="menuitem"
192-
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"
191+
class="w-full text-start gap-x-3 border-none"
193192
@click="openAuthModal"
194193
>
195194
<img
@@ -212,7 +211,7 @@ function openAuthModal() {
212211
>
213212
<span class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere') }}</span>
214213
</span>
215-
</button>
214+
</ButtonBase>
216215
</div>
217216

218217
<!-- Divider (only if we have connections AND options to connect) -->
@@ -223,11 +222,10 @@ function openAuthModal() {
223222

224223
<!-- Connect options -->
225224
<div v-if="!isNpmConnected || !atprotoUser" class="py-1">
226-
<button
225+
<ButtonBase
227226
v-if="!isNpmConnected"
228-
type="button"
229227
role="menuitem"
230-
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"
228+
class="w-full text-start gap-x-3 border-none"
231229
@click="openConnectorModal"
232230
>
233231
<span class="w-8 h-8 rounded-full bg-bg-muted flex items-center justify-center">
@@ -248,13 +246,12 @@ function openAuthModal() {
248246
</span>
249247
<span class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli_desc') }}</span>
250248
</span>
251-
</button>
249+
</ButtonBase>
252250

253-
<button
251+
<ButtonBase
254252
v-if="!atprotoUser"
255-
type="button"
256253
role="menuitem"
257-
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"
254+
class="w-full text-start gap-x-3 border-none"
258255
@click="openAuthModal"
259256
>
260257
<span class="w-8 h-8 rounded-full bg-bg-muted flex items-center justify-center">
@@ -266,7 +263,7 @@ function openAuthModal() {
266263
</span>
267264
<span class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere_desc') }}</span>
268265
</span>
269-
</button>
266+
</ButtonBase>
270267
</div>
271268
</div>
272269
</div>

app/components/Header/AuthModal.client.vue

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,9 @@ watch(handleInput, newHandleInput => {
6464
</p>
6565
</div>
6666
</div>
67-
<button
68-
class="w-full px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-accent/70"
69-
@click="logout"
70-
>
67+
<ButtonBase class="w-full" @click="logout">
7168
{{ $t('auth.modal.disconnect') }}
72-
</button>
69+
</ButtonBase>
7370
</div>
7471

7572
<!-- Disconnected state -->
@@ -111,19 +108,13 @@ watch(handleInput, newHandleInput => {
111108
<span class="font-bold">npmx.dev</span>
112109
</template>
113110
<template #atproto>
114-
<a :href="atprotoLink" target="_blank" class="text-blue-400 hover:underline">
115-
AT Protocol
116-
</a>
111+
<LinkBase :to="atprotoLink"> AT Protocol </LinkBase>
117112
</template>
118113
<template #bluesky>
119-
<a href="https://bsky.app" target="_blank" class="text-blue-400 hover:underline">
120-
Bluesky
121-
</a>
114+
<LinkBase to="https://bsky.app"> Bluesky </LinkBase>
122115
</template>
123116
<template #tangled>
124-
<a href="https://tangled.org" target="_blank" class="text-blue-400 hover:underline">
125-
Tangled
126-
</a>
117+
<LinkBase to="https://tangled.org"> Tangled </LinkBase>
127118
</template>
128119
</i18n-t>
129120
</div>
@@ -133,18 +124,17 @@ watch(handleInput, newHandleInput => {
133124
<ButtonBase type="submit" variant="primary" :disabled="!handleInput.trim()" class="w-full">
134125
{{ $t('auth.modal.connect') }}
135126
</ButtonBase>
136-
<ButtonBase type="button" variant="primary" class="w-full" @click="handleCreateAccount">
127+
<ButtonBase type="button" class="w-full" @click="handleCreateAccount">
137128
{{ $t('auth.modal.create_account') }}
138129
</ButtonBase>
139130
<hr class="color-border" />
140-
<ButtonBase type="button" variant="primary" class="w-full" @click="handleBlueskySignIn" block>
131+
<ButtonBase
132+
type="button"
133+
class="w-full"
134+
@click="handleBlueskySignIn"
135+
classicon="i-carbon:logo-bluesky"
136+
>
141137
{{ $t('auth.modal.connect_bluesky') }}
142-
<svg fill="none" viewBox="0 0 64 57" width="20" style="width: 20px">
143-
<path
144-
fill="#0F73FF"
145-
d="M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805ZM50.127 3.805C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745Z"
146-
></path>
147-
</svg>
148138
</ButtonBase>
149139
</form>
150140
</Modal>

app/components/Header/ConnectorModal.vue

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,9 @@ function handleDisconnect() {
8080
{{ $t('connector.modal.connected_hint') }}
8181
</div>
8282

83-
<button
84-
type="button"
85-
class="w-full px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-accent/70"
86-
@click="handleDisconnect"
87-
>
83+
<ButtonBase type="button" class="w-full" @click="handleDisconnect">
8884
{{ $t('connector.modal.disconnect') }}
89-
</button>
85+
</ButtonBase>
9086
</div>
9187

9288
<!-- Disconnected state -->
@@ -100,14 +96,11 @@ function handleDisconnect() {
10096
<p class="text-sm text-fg-muted">
10197
<i18n-t keypath="connector.modal.contributor_notice" scope="global">
10298
<template #link>
103-
<a
104-
href="https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md#local-connector-cli"
105-
target="_blank"
106-
rel="noopener noreferrer"
107-
class="text-blue-400 hover:underline"
99+
<LinkBase
100+
to="https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md#local-connector-cli"
108101
>
109102
{{ $t('connector.modal.contributor_link') }}
110-
</a>
103+
</LinkBase>
111104
</template>
112105
</i18n-t>
113106
</p>
@@ -124,15 +117,12 @@ function handleDisconnect() {
124117
>
125118
<span class="text-fg-subtle">$</span>
126119
<span class="text-fg-subtle ms-2">pnpm npmx-connector</span>
127-
<button
128-
type="button"
120+
<ButtonBase
129121
:aria-label="copied ? $t('connector.modal.copied') : $t('connector.modal.copy_command')"
130-
class="ms-auto text-fg-subtle p-1.5 -m-1.5 hover:text-fg transition-colors duration-200 focus-visible:outline-accent/70 rounded"
131122
@click="copy('pnpm npmx-connector')"
132-
>
133-
<span v-if="!copied" class="i-carbon:copy block w-5 h-5" aria-hidden="true" />
134-
<span v-else class="i-carbon:checkmark block w-5 h-5 text-green-500" aria-hidden="true" />
135-
</button>
123+
class="ms-auto"
124+
:classicon="copied ? 'i-carbon:checkmark text-green-500' : 'i-carbon:copy'"
125+
/>
136126
</div>
137127

138128
<!-- TODO: Uncomment when npmx-connector is published to npm

0 commit comments

Comments
 (0)