aboutsummaryrefslogtreecommitdiffstats
path: root/thallium-frontend
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-09-11 17:17:14 +0100
committerGravatar Joe Banks <[email protected]>2024-09-11 17:17:14 +0100
commit5ccaae56404df5f8dc16b3eebe17fe1d88d62d5f (patch)
treed9bc4b2ffe8574be18d0ad80664d063f98be3556 /thallium-frontend
parentType corrections (diff)
Fix eslint
Diffstat (limited to 'thallium-frontend')
-rw-r--r--thallium-frontend/src/components/CartStatus.tsx10
-rw-r--r--thallium-frontend/src/utils/hooks.ts14
2 files changed, 12 insertions, 12 deletions
diff --git a/thallium-frontend/src/components/CartStatus.tsx b/thallium-frontend/src/components/CartStatus.tsx
index 848e1cc..5b6d1e8 100644
--- a/thallium-frontend/src/components/CartStatus.tsx
+++ b/thallium-frontend/src/components/CartStatus.tsx
@@ -21,7 +21,7 @@ margin-bottom: 30px;
right: 0;
margin-right: 30px;
transition: all 0.25s;
-`
+`;
const CartStatus = () => {
const cart = useSelector((state: RootState) => state.cart);
@@ -32,16 +32,16 @@ const CartStatus = () => {
const buttonVisible = useVisible(staticButtonRef);
useEffect(() => {
- console.log(buttonVisible)
- }, [buttonVisible])
+ console.log(buttonVisible);
+ }, [buttonVisible]);
- const checkoutMsg = total > 0 ? "Checkout >" : "Add some items to proceed to checkout"
+ const checkoutMsg = total > 0 ? "Checkout >" : "Add some items to proceed to checkout";
const navigate = useNavigate();
const buttonCallback = () => {
navigate("/checkout");
- }
+ };
return <>
<StatusHolder>You currently have {total} item{total !== 1 ? "s" : null} in your cart, totalling ${price.toFixed(2)} USD</StatusHolder>
diff --git a/thallium-frontend/src/utils/hooks.ts b/thallium-frontend/src/utils/hooks.ts
index 997f274..337ccf2 100644
--- a/thallium-frontend/src/utils/hooks.ts
+++ b/thallium-frontend/src/utils/hooks.ts
@@ -2,16 +2,16 @@ import { useState, useEffect } from "react";
import { type RefObject } from "react";
export function useVisible(ref: RefObject<HTMLElement>) {
- const [isVisible, setVisible] = useState(false)
+ const [isVisible, setVisible] = useState(false);
useEffect(() => {
const observer = new IntersectionObserver(
- ([entry]) => setVisible(entry.isIntersecting)
- )
+ ([entry]) => { setVisible(entry.isIntersecting); }
+ );
if (ref.current)
- observer.observe(ref.current)
- return () => observer.disconnect()
- }, [])
+ observer.observe(ref.current);
+ return () => { observer.disconnect(); };
+ }, [ref]);
- return isVisible
+ return isVisible;
}