Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/nowait-user/src/assets/icon/cancel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions apps/nowait-user/src/assets/icon/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 97 additions & 2 deletions apps/nowait-user/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { AnimatePresence, motion } from "framer-motion";
import { useNavigate } from "react-router-dom";
import Logo from "../assets/logo.svg?react";
import Menu from "../assets/icon/menu.svg?react";
import Search from "../assets/icon/search_black.svg?react";
import Search from "../assets/icon/search.svg?react";
import Cancel from "../assets/icon/cancel.svg?react";
import Portal from "./common/modal/Portal";

const HomeHeader = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
const [isSearchOpen, setIsSearchOpen] = useState(false);
const navigate = useNavigate();

const toggleMenu = () => {
Expand All @@ -19,6 +20,14 @@ const HomeHeader = () => {
setIsMenuOpen(false);
};

const openSearch = () => {
setIsSearchOpen(true);
};

const closeSearch = () => {
setIsSearchOpen(false);
};

const handleBookmarkClick = () => {
closeMenu();
navigate("/bookmark");
Expand All @@ -34,7 +43,7 @@ const HomeHeader = () => {
<div className="flex justify-between items-center py-4">
<Logo className="w-14.5 h-6" />
<div className="flex flex-row gap-3">
<button onClick={() => {}} className="cursor-pointer">
<button onClick={openSearch} className="cursor-pointer">
<Search className="icon-m" />
</button>
<button onClick={toggleMenu} className="cursor-pointer">
Expand Down Expand Up @@ -113,6 +122,92 @@ const HomeHeader = () => {
)}
</AnimatePresence>
</Portal>

{/* 전체 화면 검색 모달 */}
<Portal>
<AnimatePresence>
{isSearchOpen && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="fixed inset-0 z-50 bg-white px-5"
>
<div className="max-w-[430px] min-w-[360px] w-full h-full bg-white mx-auto">
{/* 검색 헤더 */}
<motion.div
initial={{ y: -20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
exit={{ y: -20, opacity: 0 }}
transition={{ duration: 0.3 }}
className="flex items-center gap-4 pt-4 mb-10"
>
<div className="flex-1 relative">
<Search className="absolute left-4 top-1/2 transform -translate-y-1/2 icon-s text-black-60" />
<input
type="text"
placeholder="주점명, 메뉴, 학과 검색"
className="w-full h-12 pl-12 pr-4 bg-black-15 rounded-2xl text-16-regular text-black-60 placeholder:text-16-regular placeholder:text-black-50 focus:outline-none focus:border-primary"
autoFocus
/>
</div>
<button
onClick={closeSearch}
className="text-16-medium text-black-70"
>
닫기
</button>
</motion.div>

{/* 검색 내용 영역 */}
<motion.div
initial={{ y: 20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
exit={{ y: 20, opacity: 0 }}
transition={{ duration: 0.3, delay: 0.1 }}
className="flex-1"
>
<div className="flex flex-col gap-4">
<div className="flex text-16-bold leading-[144%] tracking-[-0.01em] text-black-90">
최근 검색
</div>
<div className="flex flex-row justify-between">
<div className="flex text-16-regular text-black-90">
스페이시스
</div>
<div className="flex">
<button className="flex">
<Cancel className="icon-xs text-black-60" />
</button>
</div>
</div>
<div className="flex flex-row justify-between">
<div className="flex text-16-regular text-black-90">
스페이시스
</div>
<div className="flex">
<button className="flex">
<Cancel className="icon-xs text-black-60" />
</button>
</div>
</div>
<div className="flex flex-row justify-between">
<div className="flex text-16-regular text-black-90">
스페이시스
</div>
<div className="flex">
<button className="flex">
<Cancel className="icon-xs text-black-60" />
</button>
</div>
</div>
</div>
</motion.div>
</div>
</motion.div>
)}
</AnimatePresence>
</Portal>
</>
);
};
Expand Down