import HotKeyPad from 'hotkeypad'
import 'hotkeypad/index.css'
const hotkeypad = new HotKeyPad({
placeholder: 'Type a command or search...',
activationLetter: 'K'
})
hotkeypad.setCommands([
// Navigation commands
{
id: 'home',
title: 'Go to Home',
icon: 'home',
hotkey: `${hotkeypad.activationKey} + H`,
section: 'Navigation',
handler: () => {
window.location.href = '/'
}
},
{
id: 'about',
title: 'Go to About',
icon: 'aboutdotme',
hotkey: `${hotkeypad.activationKey} + A`,
section: 'Navigation',
handler: () => {
window.location.href = '/about'
}
},
{
id: 'contact',
title: 'Go to Contact',
icon: 'gmail',
hotkey: `${hotkeypad.activationKey} + C`,
section: 'Navigation',
handler: () => {
window.location.href = '/contact'
}
},
// Theme commands
{
id: 'dark-mode',
title: 'Toggle Dark Mode',
icon: 'darkreader',
hotkey: `${hotkeypad.activationKey} + D`,
section: 'Appearance',
handler: () => {
document.documentElement.classList.toggle('dark')
}
},
// Action commands
{
id: 'print',
title: 'Print Page',
icon: 'print',
hotkey: `${hotkeypad.activationKey} + P`,
section: 'Actions',
handler: () => {
window.print()
}
},
{
id: 'share',
title: 'Share Page',
icon: 'x',
hotkey: `${hotkeypad.activationKey} + S`,
section: 'Actions',
handler: async () => {
if (navigator.share) {
await navigator.share({
title: document.title,
url: window.location.href
})
}
}
},
{
id: 'copy-url',
title: 'Copy URL',
icon: 'link',
hotkey: `${hotkeypad.activationKey} + U`,
section: 'Actions',
handler: async () => {
await navigator.clipboard.writeText(window.location.href)
alert('URL copied to clipboard!')
}
}
])