Skip to content

Commit

Permalink
[feat] 이벤트 종류 선택 탭바 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
lybell-art committed Aug 15, 2024
1 parent 408ea99 commit a06116e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/adminPage/features/eventEdit/EventDetailInput.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function EventTypeSelector({selected, onClick, children})
{
const selectorBaseStyle = `flex justify-center items-center px-8 py-2 rounded-t-lg text-body-m relative hover:bg-blue-50`;
const selectedStyle = `text-blue-400 font-bold after:w-full after:h-1 after:absolute after:-bottom-px after:border-b-2 after:border-blue-400`;
const unSelectedStyle = `text-neutral-800 hover:text-blue-400`;

return <button type="button" className={`${selectorBaseStyle} ${selected ? selectedStyle : unSelectedStyle}`} onClick={onClick}>{children}</button>
}

function EventDetailInput({state, dispatch, mode})
{
function selectEventType(type)
{
return ()=>{
if(mode === "edit") return;
dispatch({type: "set_event_type", value:type});
}
}

return <div className="w-full">
<div className="flex w-full border-b border-neutral-200">
<EventTypeSelector selected={state.eventType === "fcfs"} onClick={selectEventType("fcfs")}>
선착순
</EventTypeSelector>
<EventTypeSelector selected={state.eventType === "draw"} onClick={selectEventType("draw")}>
추첨
</EventTypeSelector>
</div>
<div className="flex-grow flex justify-center items-center p-4">
</div>
</div>
}

export default EventDetailInput;
7 changes: 7 additions & 0 deletions src/adminPage/features/eventEdit/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useReducer } from "react";
import { eventEditReducer, setDefaultState } from "./businessLogic/reducer.js";

import EventBaseDataInput from "./EventBaseDataInput.jsx";
import EventDetailInput from "./EventDetailInput.jsx";
import Button from "@common/components/Button.jsx";

function EventEditor({mode, initialData = null} = {}) {
Expand All @@ -27,6 +28,12 @@ function EventEditor({mode, initialData = null} = {}) {
</div>
<div className="w-full flex flex-col gap-3">
<EventBaseDataInput state={state} dispatch={dispatch} mode={mode} />
<div className="grid grid-cols-[6rem_1fr] items-start gap-2">
<span className="py-2 text-center">
이벤트 종류<sup className="text-red-500">*</sup>
</span>
<EventDetailInput state={state} dispatch={dispatch} mode={mode} />
</div>
</div>
</form>
}
Expand Down

0 comments on commit a06116e

Please sign in to comment.