Skip to content

Commit b80ea63

Browse files
committed
fix(dashboard): open editor when clicking config cards
1 parent 259a062 commit b80ea63

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

‎src/lib/components/ConfigRow.svelte‎

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { resolve } from '$app/paths';
23
import ContextMenu from './ContextMenu.svelte';
34
import PackageFingerprint from './PackageFingerprint.svelte';
45
@@ -66,7 +67,13 @@
6667
<div class="row-top">
6768
<div class="identity">
6869
<div class="id-head">
69-
<h3 class="row-name">{config.name}</h3>
70+
<h3 class="row-name">
71+
<a
72+
class="edit-link"
73+
href={resolve(`/dashboard/edit/${config.slug}`)}
74+
aria-label={`Edit ${config.name}`}
75+
>{config.name}</a>
76+
</h3>
7077
<span class="vis-tag" class:public={config.visibility === 'public'}>{config.visibility}</span>
7178
</div>
7279
{#if cli + apps + npm > 0}
@@ -103,12 +110,15 @@
103110
<button class="icon-btn" aria-label="Edit" onclick={() => onaction('edit', config.slug)}>
104111
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z"/></svg>
105112
</button>
106-
<ContextMenu square items={menuItems} onselect={(action) => onaction(action, config.slug)} />
113+
<div class="more-actions">
114+
<ContextMenu square items={menuItems} onselect={(action) => onaction(action, config.slug)} />
115+
</div>
107116
</div>
108117
</div>
109118

110119
<style>
111120
.row {
121+
position: relative;
112122
background: var(--bg-secondary);
113123
border: 1px solid var(--border);
114124
border-radius: 14px;
@@ -122,6 +132,36 @@
122132
box-shadow: 0 16px 34px -16px var(--shadow);
123133
}
124134
135+
.edit-link {
136+
color: inherit;
137+
text-decoration: none;
138+
}
139+
140+
/* Stretch the edit link across the card, below the independent actions. */
141+
.edit-link::after {
142+
content: '';
143+
position: absolute;
144+
inset: 0;
145+
z-index: 0;
146+
border-radius: 14px;
147+
}
148+
149+
.edit-link:focus-visible {
150+
outline: none;
151+
}
152+
153+
.edit-link:focus-visible::after {
154+
outline: 2px solid var(--accent);
155+
outline-offset: 3px;
156+
}
157+
158+
.copy-cmd,
159+
.icon-btn,
160+
.more-actions {
161+
position: relative;
162+
z-index: 1;
163+
}
164+
125165
.row-top {
126166
display: flex;
127167
align-items: flex-start;

0 commit comments

Comments
 (0)