Skip to content

Commit

Permalink
Merge pull request #390 from TripInfoWeb/dev_informations
Browse files Browse the repository at this point in the history
Feat: 정보 검색 시 아무 것도 입력하지 않을 때 전체 검색 적용
  • Loading branch information
HyunJinNo authored Sep 27, 2024
2 parents 1e4a259 + e8af9a4 commit 033a0dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 7 additions & 1 deletion src/components/diary/list/DiaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ const DiaryCard = ({ diaryData, flag, isFlipped, flip }: Props) => {
whileInView={{ opacity: 1 }}
transition={{ delay: 0.3 }}
>
<h2 className="text-start text-2xl font-bold">{diaryData.title}</h2>
<Link
className="text-start text-2xl font-bold hover:text-main"
href={`/diary/${diaryData.diaryId}`}
onClick={(e) => e.stopPropagation()}
>
{diaryData.title}
</Link>
<p className="text-lg">{`${new Date(new Date(diaryData.startDatetime).getTime() + 1000 * 60 * 60 * 24).toLocaleDateString("ko-KR")}`}</p>
</motion.div>
</motion.button>
Expand Down
16 changes: 5 additions & 11 deletions src/containers/informations/list/InformationSearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { useState } from "react";

const InformationSearchContainer = () => {
const [modalVisible, setModalVisible] = useState<boolean>(false);
const [orderDropdownVisible, setOrderDropdownVisible] =
useState<boolean>(false);
const [modalVisible, setModalVisible] = useState(false);
const [orderDropdownVisible, setOrderDropdownVisible] = useState(false);
const pathname = usePathname();
const searchParams = useSearchParams();
const parentCategoryId = searchParams.get("parentCategoryId")!;
const childCategoryId = searchParams.get("childCategoryId");
const place = searchParams.get("place") ?? "";
const order = searchParams.get("order") ?? "latest";
const [searchValue, setSearchValue] = useState<string>("");
const [searchMethod, setSearchMethod] = useState<string>("제목");
const [searchValue, setSearchValue] = useState("");
const [searchMethod, setSearchMethod] = useState("제목");
const [searchDropdownVisible, setSearchDropdownVisible] =
useState<boolean>(false);
const router = useRouter();
Expand All @@ -34,12 +33,7 @@ const InformationSearchContainer = () => {
};

const onSearchClick = () => {
if (searchMethod === "제목" && searchValue.length < 1) {
alert("최소 한 글자의 제목을 입력해 주세요.");
return;
}

if (searchMethod === "태그" && searchValue.length < 2) {
if (searchMethod === "태그" && searchValue.length === 1) {
alert("2 ~ 15자의 태그를 입력해 주세요.");
return;
}
Expand Down

0 comments on commit 033a0dc

Please sign in to comment.