-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] 어드민 기대평 이벤트 검색 일부 구현 #96
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,79 @@ | ||
import Container from "@admin/components/Container.jsx"; | ||
import { useState } from "react"; | ||
|
||
export default function CommentsPage() { | ||
const [formString, setFormString] = useState(""); | ||
const [isSpread, setIsSpread] = useState(false); | ||
const searchList = [ | ||
{ | ||
id: "HD_2409_01", | ||
name: "이벤트", | ||
}, | ||
{ | ||
id: "HD_2409_02", | ||
name: "이벤트", | ||
}, | ||
{ | ||
id: "HD_2409_03", | ||
name: "이벤트", | ||
}, | ||
]; | ||
|
||
function onChangeForm(e) { | ||
const inputString = e.target.value; | ||
const numberRegex = /^\d*$/; | ||
|
||
if (inputString.length <= 6 && numberRegex.test(inputString)) { | ||
setFormString(inputString); | ||
} | ||
} | ||
|
||
function searchComment(e, eventId) { | ||
e.preventDefault(); | ||
|
||
if (eventId) console.log(eventId + " 검색"); | ||
else console.log(formString + " 검색"); | ||
} | ||
|
||
return ( | ||
<Container> | ||
<div className="flex flex-col w-full h-dvh p-20"> | ||
<span className="text-title-l">기대평</span> | ||
|
||
<form onSubmit={searchComment} className="relative mt-10 flex"> | ||
<input | ||
type="text" | ||
inputMode="numeric" | ||
onChange={onChangeForm} | ||
onFocus={() => setIsSpread(true)} | ||
onBlur={() => setIsSpread(false)} | ||
value={formString} | ||
placeholder="ID (숫자 6자리)" | ||
className={`outline outline-1 outline-neutral-500 px-4 py-2 w-full ${isSpread ? "rounded-t-md" : "rounded-md"}`} | ||
/> | ||
|
||
<div | ||
className={`absolute top-full outline outline-1 w-full outline-neutral-500 rounded-b-md px-3 py-2 flex flex-col gap-2 ${!isSpread && "hidden"}`} | ||
> | ||
{searchList.map((evt) => ( | ||
<li | ||
key={evt.id} | ||
className="list-none w-full hover:bg-blue-200 rounded px-1 flex" | ||
> | ||
<span className="w-40">{evt.id}</span> | ||
<span>{evt.name}</span> | ||
</li> | ||
))} | ||
</div> | ||
|
||
<img | ||
onClick={searchComment} | ||
src="/icons/search.png" | ||
alt="검색" | ||
className="absolute top-1/2 -translate-y-1/2 right-4 cursor-pointer" | ||
/> | ||
</form> | ||
</div> | ||
</Container> | ||
); | ||
} |
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 |
---|---|---|
|
@@ -31,13 +31,9 @@ export default function InteractionAnswer({ | |
// 추첨 이벤트 참가 전송. API 주소 추후 바뀔 수 있음 | ||
fetchServer(`/api/v1/draw/${EVENT_DRAW_ID}`, { | ||
method: "POST", | ||
}) | ||
.then((res) => { | ||
console.log(res); | ||
Comment on lines
-34
to
-36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 편안합니다 |
||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
}); | ||
}).catch((e) => { | ||
console.log(e); | ||
}); | ||
}} | ||
/> | ||
); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
웬만해서는 간단한 레이아웃이 아닌 이상 복잡한 상태가 있는 로직들은 features/comment 폴더 파서 거기다가 넣는게 좋습니다.
pages에 있는 건 라우터가 아닌 이상 상태가 없어야 해요