Skip to content

Commit e29aa13

Browse files
committed
Added svelte-command-palette package to website
1 parent 46aa25e commit e29aa13

File tree

4 files changed

+75
-2
lines changed

4 files changed

+75
-2
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"editor.formatOnSave": false
2+
"editor.formatOnSave": true,
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
34
}

package-lock.json

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"fuse.js": "^6.6.2",
4545
"i": "^0.3.7",
4646
"npm": "^8.10.0",
47+
"svelte-command-palette": "^1.0.0",
4748
"svelte2tsx": "^0.5.10",
4849
"tinykeys": "^1.4.0"
4950
},

src/routes/__layout-doc.svelte

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1-
<slot />
1+
<script>
2+
import { goto } from '$app/navigation';
3+
4+
import CommandPalette, { defineActions } from 'svelte-command-palette';
5+
6+
let actions = defineActions([
7+
{
8+
title: 'Go to demo',
9+
subTitle: 'Learn how to use svelte-command-palette',
10+
onRun: () => {
11+
goto('/');
12+
},
13+
shortcut: 'D D'
14+
},
15+
{
16+
title: 'Go to paletteStore docs',
17+
subTitle: 'Learn how to use paletteStore',
18+
onRun: () => {
19+
goto('/docs/palette-store');
20+
},
21+
shortcut: 'D D'
22+
},
23+
{
24+
title: 'Open Github',
25+
subTitle: 'Go to github in a new tab',
26+
onRun: () => {
27+
window.open('https://github.com');
28+
},
29+
shortcut: 'Space k'
30+
},
31+
32+
{
33+
title: 'Open twitter',
34+
subTitle: 'Open my twitter handle in a new tab',
35+
onRun: () => {
36+
window.open('https://twitter.com/rohitpotato');
37+
},
38+
shortcut: 'T T'
39+
}
40+
]);
41+
</script>
42+
43+
<CommandPalette commands={actions} />
44+
45+
<slot />

0 commit comments

Comments
 (0)