aboutsummaryrefslogtreecommitdiff
path: root/apps/web
diff options
context:
space:
mode:
authorKinfe123 <[email protected]>2024-06-24 10:46:19 +0300
committerKinfe123 <[email protected]>2024-06-24 10:46:19 +0300
commit875694ee2de77fc6e52bb9f1962a9ad744b2a02a (patch)
tree2fcfed66857c062eb80cc3eb19ad8fe3c10ae959 /apps/web
parentfix: unused import and unwanted import (diff)
downloadsupermemory-875694ee2de77fc6e52bb9f1962a9ad744b2a02a.tar.xz
supermemory-875694ee2de77fc6e52bb9f1962a9ad744b2a02a.zip
fix: making type safe
Diffstat (limited to 'apps/web')
-rw-r--r--apps/web/app/(landing)/Headers/Navbar.tsx26
1 files changed, 19 insertions, 7 deletions
diff --git a/apps/web/app/(landing)/Headers/Navbar.tsx b/apps/web/app/(landing)/Headers/Navbar.tsx
index 9f3caa93..c698947c 100644
--- a/apps/web/app/(landing)/Headers/Navbar.tsx
+++ b/apps/web/app/(landing)/Headers/Navbar.tsx
@@ -33,7 +33,9 @@ const SlideTabs = () => {
<Image src={Logo} alt="Supermemory logo" width={40} height={40} />
</Link>
- <Tab setPosition={setPosition}>Home</Tab>
+ <Tab key={0} setPosition={setPosition}>
+ Home
+ </Tab>
<Tab setPosition={setPosition}>Pricing</Tab>
<Tab setPosition={setPosition}>Features</Tab>
<Tab setPosition={setPosition}>Docs</Tab>
@@ -51,20 +53,30 @@ const SlideTabs = () => {
</ul>
);
};
-// @ts-ignore
-const Tab = ({ children, setPosition }) => {
- const ref = useRef(null);
+const Tab = ({
+ children,
+ setPosition,
+}: {
+ children: React.ReactNode;
+ setPosition: ({
+ left,
+ width,
+ opacity,
+ }: {
+ left: number;
+ width: number;
+ opacity: number;
+ }) => void;
+}) => {
+ const ref = useRef<HTMLLIElement>(null);
return (
<li
ref={ref}
onMouseEnter={() => {
if (!ref?.current) return;
- // @ts-ignore
const { width } = ref.current.getBoundingClientRect();
-
setPosition({
- // @ts-ignore
left: ref.current.offsetLeft,
width,
opacity: 1,