- {latestData.closePrice.toLocaleString()}
-
+
+ {latestData.closePrice.toLocaleString()}
+
{arrow} {Math.abs(latestData.changeAmount).toFixed(2)} ({sign}
{latestData.changeRate.toFixed(2)}%)
-
+
diff --git a/src/components/Navbar/Logo.tsx b/src/components/Navbar/Logo.tsx
index 402eb2c..5066f6c 100644
--- a/src/components/Navbar/Logo.tsx
+++ b/src/components/Navbar/Logo.tsx
@@ -2,8 +2,10 @@ import { Link } from "react-router-dom";
const Logo = () => {
return (
-
-
STPT
+
+
+ STPT
+
);
};
diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx
index 099ca98..f7b9822 100644
--- a/src/components/Navbar/Navbar.tsx
+++ b/src/components/Navbar/Navbar.tsx
@@ -1,17 +1,82 @@
import Logo from "@/components/Navbar/Logo";
import NavItem from "@/components/Navbar/NavItem";
import SearchBar from "@/components/Navbar/SearchBar";
+import SideBarButton from "@/components/Navbar/SideBarButton";
+import { Link } from "react-router-dom";
+import { useState, useEffect, useRef } from "react";
const Navbar = () => {
+ const [isSideBarOpen, setIsSideBarOpen] = useState(false);
+ const modalRef = useRef
(null);
+ const buttonRef = useRef(null);
+
+ // 외부 클릭 시 모달 닫기
+ useEffect(() => {
+ const handleClickOutside = (event: MouseEvent) => {
+ const target = event.target as Node;
+ if (
+ modalRef.current &&
+ !modalRef.current.contains(target) &&
+ buttonRef.current &&
+ !buttonRef.current.contains(target)
+ ) {
+ setIsSideBarOpen(false);
+ }
+ };
+
+ if (isSideBarOpen) {
+ document.addEventListener("mousedown", handleClickOutside);
+ }
+
+ return () => {
+ document.removeEventListener("mousedown", handleClickOutside);
+ };
+ }, [isSideBarOpen]);
+
return (
-
+ <>
+
+ >
);
};
diff --git a/src/components/Navbar/SideBarButton.tsx b/src/components/Navbar/SideBarButton.tsx
new file mode 100644
index 0000000..505ad0e
--- /dev/null
+++ b/src/components/Navbar/SideBarButton.tsx
@@ -0,0 +1,34 @@
+import { Button } from "@/components/ui/button";
+
+interface SideBarButtonProps {
+ isOpen: boolean;
+ onClick: () => void;
+}
+
+export default function SideBarButton({ isOpen, onClick }: SideBarButtonProps) {
+ return (
+
+ );
+}