Skip to content

Full Toolkit for Next-Level Domain Analysis

Add keyboard shortcuts for tabs ⌨️

Felix Wotschofskyfd8b9063e87b
diff --git a/components/ResultsTabs.tsx b/components/ResultsTabs.tsx
index 5f1c6ce..2834a36 100644
--- a/components/ResultsTabs.tsx
+++ b/components/ResultsTabs.tsx
@@ -1,29 +1,40 @@
'use client';
+import { OptionIcon } from 'lucide-react';
import Link from 'next/link';
-import { useSelectedLayoutSegment } from 'next/navigation';
-import { FC } from 'react';
+import { useRouter, useSelectedLayoutSegment } from 'next/navigation';
+import type { FC } from 'react';
+import { useHotkeys } from 'react-hotkeys-hook';
type ResultsTabsProps = {
domain: string;
};
const ResultsTabs: FC<ResultsTabsProps> = ({ domain }) => {
+ const router = useRouter();
const selectedSegment = useSelectedLayoutSegment();
+ useHotkeys('alt+1', () => router.push(`/lookup/${domain}`), [router]);
+ useHotkeys('alt+2', () => router.push(`/lookup/${domain}/whois`), [router]);
+ useHotkeys('alt+3', () => router.push(`/lookup/${domain}/certs`), [router]);
+
return (
- <div className="mb-6 mt-6 border-b border-gray-200 text-center text-sm font-medium text-gray-500 dark:border-gray-700 dark:text-gray-400">
+ <div className="group mb-6 mt-6 border-b border-gray-200 text-center text-sm font-medium text-gray-500 dark:border-gray-700 dark:text-gray-400">
<ul className="-mb-px flex flex-wrap">
<li className="mr-2">
<Link
href={`/lookup/${domain}`}
className={
selectedSegment === null
- ? 'inline-block rounded-t-lg border-b-2 border-primary p-4 text-primary'
- : 'inline-block rounded-t-lg border-b-2 border-transparent p-4 hover:border-gray-300 hover:text-gray-600 dark:hover:text-gray-300'
+ ? 'relative inline-block rounded-t-lg border-b-2 border-primary p-4 text-primary'
+ : 'relative inline-block rounded-t-lg border-b-2 border-transparent p-4 hover:border-gray-300 hover:text-gray-600 dark:hover:text-gray-300'
}
>
DNS
+ <div className="pointer-events-none absolute bottom-0 translate-y-4 text-xs text-muted-foreground opacity-0 transition-all group-hover:translate-y-6 group-hover:opacity-100">
+ <OptionIcon className="inline-block h-3 w-3" strokeWidth={3} />
+ {' + 1'}
+ </div>
</Link>
</li>
<li className="mr-2">
@@ -31,12 +42,16 @@ const ResultsTabs: FC<ResultsTabsProps> = ({ domain }) => {
href={`/lookup/${domain}/whois`}
className={
selectedSegment === 'whois'
- ? 'inline-block rounded-t-lg border-b-2 border-primary p-4 text-primary'
- : 'inline-block rounded-t-lg border-b-2 border-transparent p-4 hover:border-gray-300 hover:text-gray-600 dark:hover:text-gray-300'
+ ? 'relative inline-block rounded-t-lg border-b-2 border-primary p-4 text-primary'
+ : 'relative inline-block rounded-t-lg border-b-2 border-transparent p-4 hover:border-gray-300 hover:text-gray-600 dark:hover:text-gray-300'
}
aria-current="page"
>
Whois
+ <div className="pointer-events-none absolute bottom-0 translate-y-4 text-xs text-muted-foreground opacity-0 transition-all group-hover:translate-y-6 group-hover:opacity-100">
+ <OptionIcon className="inline-block h-3 w-3" strokeWidth={3} />
+ {' + 2'}
+ </div>
</Link>
</li>
<li className="mr-2">
@@ -44,12 +59,16 @@ const ResultsTabs: FC<ResultsTabsProps> = ({ domain }) => {
href={`/lookup/${domain}/certs`}
className={
selectedSegment === 'certs'
- ? 'inline-block rounded-t-lg border-b-2 border-primary p-4 text-primary'
- : 'inline-block rounded-t-lg border-b-2 border-transparent p-4 hover:border-gray-300 hover:text-gray-600 dark:hover:text-gray-300'
+ ? 'relative inline-block rounded-t-lg border-b-2 border-primary p-4 text-primary'
+ : 'relative inline-block rounded-t-lg border-b-2 border-transparent p-4 hover:border-gray-300 hover:text-gray-600 dark:hover:text-gray-300'
}
aria-current="page"
>
Certs
+ <div className="pointer-events-none absolute bottom-0 translate-y-4 text-xs text-muted-foreground opacity-0 transition-all group-hover:translate-y-6 group-hover:opacity-100">
+ <OptionIcon className="inline-block h-3 w-3" strokeWidth={3} />
+ {' + 3'}
+ </div>
</Link>
</li>
</ul>
diff --git a/package.json b/package.json
index b5f3d4c..e265426 100644
--- a/package.json
+++ b/package.json
@@ -36,6 +36,7 @@
"punycode": "^2.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
+ "react-hotkeys-hook": "^4.4.1",
"react-icons": "^4.10.1",
"react-leaflet": "^4.2.1",
"react-string-replace": "^1.1.1",
diff --git a/yarn.lock b/yarn.lock
index 9ea7d6f..e92c371 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2653,6 +2653,11 @@ [email protected]:
loose-envify "^1.1.0"
scheduler "^0.23.0"
+react-hotkeys-hook@^4.4.1:
+ version "4.4.1"
+ resolved "https://registry.yarnpkg.com/react-hotkeys-hook/-/react-hotkeys-hook-4.4.1.tgz#1f7a7a1c9c21d4fa3280bf340fcca8fd77d81994"
+ integrity sha512-sClBMBioFEgFGYLTWWRKvhxcCx1DRznd+wkFHwQZspnRBkHTgruKIHptlK/U/2DPX8BhHoRGzpMVWUXMmdZlmw==
+
react-icons@^4.10.1:
version "4.10.1"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.10.1.tgz#3f3b5eec1f63c1796f6a26174a1091ca6437a500"