-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from TripInfoWeb/dev_gathering
feat: 뒤로가기 시 주소에 따라 필터 관련 UI 렌더링되게 변경
- Loading branch information
Showing
14 changed files
with
376 additions
and
209 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { GatheringRecommend } from "@/types/GatheringDto"; | ||
import GatheringItem from "../common/GatheringItem"; | ||
|
||
interface IGatheringCardList { | ||
data: GatheringRecommend[] | ||
} | ||
const GatheringCardList = ({data}: IGatheringCardList) => { | ||
return ( | ||
<div className="min-h-[20rem]"> | ||
<div className="my-6 grid min-[745px]:grid-cols-2 m-auto gap-x-3 gap-y-3"> | ||
{data?.map((i, index) => ( | ||
<GatheringItem | ||
key={i.gatheringId} | ||
{...i} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default GatheringCardList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
interface IGatheringSearch { | ||
keywordRef: React.RefObject<HTMLInputElement>; | ||
searchHandler: (value: string) => void; | ||
} | ||
const GatheringSearch = (props: IGatheringSearch) => { | ||
return ( | ||
<label className="relative min-[745px]:w-full min-[745px]:max-w-[28rem] w-full max-[768px]:w-full group"> | ||
<input | ||
className="bg-[0rem_center] w-full pb-1 pl-8 pr-[3.5rem] border-b-[0.0625rem] border-black bg-search-icon bg-[length:1rem] bg-no-repeat text-sm outline-none placeholder:font-medium placeholder:text-gray2" | ||
type="text" | ||
autoComplete="search" | ||
name="search" | ||
placeholder="검색하기" | ||
maxLength={30} | ||
ref={props.keywordRef} | ||
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (e.ctrlKey && e.key === 'Enter' && props.keywordRef.current) { | ||
props.searchHandler(props.keywordRef.current.value); | ||
} | ||
}} | ||
/> | ||
<button | ||
className="absolute right-[0rem] bg-main text-white px-3 rounded-md opacity-0 transition-opacity duration-300 group-hover:opacity-100 group-focus-within:opacity-100" | ||
onClick={() => { | ||
if (props.keywordRef.current) { | ||
props.searchHandler(props.keywordRef.current.value); | ||
} | ||
}} | ||
> | ||
검색 | ||
</button> | ||
</label> | ||
); | ||
}; | ||
export default GatheringSearch |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import GatheringCardList from "@/components/gathering/GatheringCardList"; | ||
import UrlQueryStringToObject from "@/utils/UrlQueryStringToObject"; | ||
import { useSearchParams } from "next/navigation"; | ||
import { useEffect, useState } from "react"; | ||
import PaginationContainer from "../common/PaginationContainer"; | ||
|
||
interface IGatheringCardListContainer { | ||
|
||
} | ||
const GatheringCardListContainer = (props: IGatheringCardListContainer) => { | ||
const searchParams = useSearchParams(); | ||
const [page, setPage] = useState(searchParams.get('page') || 0); | ||
const [totalData, setTotalData] = useState(10); | ||
const changeGatheringPageHandler = (id: number) => { | ||
let _url = `/gathering?`; | ||
let temp = UrlQueryStringToObject(window.location.href) || {}; | ||
if (page != 0) { | ||
temp.page = id; | ||
} | ||
Object.entries(temp).map(i => { | ||
_url += i[0]+"="+i[1]+"&" | ||
}) | ||
if (_url.endsWith("&")) { | ||
_url = _url.slice(0, -1); | ||
} | ||
console.log("GatheringListContainer.tsx 파일 : ", _url); | ||
window.history.pushState(null, "", _url); | ||
} | ||
|
||
useEffect(() => { | ||
|
||
}, [searchParams]) | ||
return ( | ||
<div> | ||
<GatheringCardList data={[]} /> | ||
<PaginationContainer currentPage={+page} totalPages={totalData} /> | ||
</div> | ||
); | ||
}; | ||
export default GatheringCardListContainer |
Oops, something went wrong.