Skip to content

Commit

Permalink
chore : 드롭다운 수정
Browse files Browse the repository at this point in the history
chore : 드롭다운 수정
  • Loading branch information
phyuna0525 authored Jul 8, 2024
2 parents 1309714 + 50b69f6 commit b5f64de
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 31 deletions.
12 changes: 10 additions & 2 deletions src/app/WeekendMeals/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,16 @@ const WeekendMeals: NextPage = () => {
전체 학생 보기
</Button>
<div className=" flex gap-5">
<Dropdown type="grade" onChange={handleGradeChange} />
<Dropdown type="class" onChange={handleClassChange} />
<Dropdown
type="grade"
onChange={handleGradeChange}
homeRoom={true}
/>
<Dropdown
type="class"
onChange={handleClassChange}
homeRoom={true}
/>
</div>
</>
}
Expand Down
20 changes: 12 additions & 8 deletions src/app/classManage/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ const ClassManage: React.FC = () => {
const [selectedGrade, setSelectedGrade] = useState<number>(1);
const [selectedClass, setSelectedClass] = useState<number>(1);
const [data, setData] = useState<StudentData>();
const {
selectedStudents,
selectedStudentNames,
modifiedStudents,
handleManageListClick,
} = useManageListSelection();
const { selectedStudentNames, modifiedStudents, handleManageListClick } =
useManageListSelection();
const { mutate: getStudentDataMutate } = GetStudentData();
const { mutate: changestatusMutate } = ChangeStatus();

Expand Down Expand Up @@ -147,8 +143,16 @@ const ClassManage: React.FC = () => {
</Button>
)}
<div className="flex gap-5">
<Dropdown type="grade" onChange={handleGradeChange} />
<Dropdown type="class" onChange={handleClassChange} />
<Dropdown
type="grade"
onChange={handleGradeChange}
homeRoom={true}
/>
<Dropdown
type="class"
onChange={handleClassChange}
homeRoom={true}
/>
</div>
</>
}
Expand Down
21 changes: 12 additions & 9 deletions src/app/components/common/dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import downarrow from "@/assets/img/Icon/downarrow.svg";
interface DropProps {
type: "floor" | "grade" | "class" | "club" | "all";
onChange?: (selectedOption: any, type: string) => void;
homeRoom?: boolean;
}

const Dropdown: React.FC<DropProps> = ({ type, onChange }) => {
const Dropdown: React.FC<DropProps> = ({ type, onChange, homeRoom }) => {
const [selectedGradeOption, setSelectedGradeOption] = useState<number>(1);
const [selectedClassOption, setSelectedClassOption] = useState<number>(1);
const [selectedFloorOption, setSelectedFloorOption] = useState<number>(5);
Expand All @@ -23,15 +24,17 @@ const Dropdown: React.FC<DropProps> = ({ type, onChange }) => {
};

useEffect(() => {
const grade = parseInt(localStorage.getItem("grade") || "1", 10);
const class_num = parseInt(localStorage.getItem("class_num") || "1", 10);
const setgrade = grade === 0 ? 1 : grade;
const setclass_num = class_num === 0 ? 1 : class_num;
if (type === "all") {
setSelectedAllOption(setgrade);
if (homeRoom) {
const grade = parseInt(localStorage.getItem("grade") || "1", 10);
const class_num = parseInt(localStorage.getItem("class_num") || "1", 10);
const setgrade = grade === 0 ? 1 : grade;
const setclass_num = class_num === 0 ? 1 : class_num;
if (type === "all") {
setSelectedAllOption(setgrade);
}
setSelectedGradeOption(setgrade);
setSelectedClassOption(setclass_num);
}
setSelectedGradeOption(setgrade);
setSelectedClassOption(setclass_num);

const handleClickOutside = (event: MouseEvent) => {
if (
Expand Down
16 changes: 8 additions & 8 deletions src/app/components/common/surveyModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ const SurveyModal = ({ onClick }: SurveyProp) => {
좀 더 좋은 PiCK으로 업데이트를 위해 만족도 조사를 하려고 합니다.
<br />
많은 참여 부탁드립니다
<a
href="https://forms.gle/fAQ9yoNTyQvdY4q59"
className="text-heading6-M select-none underline text-primary-400"
target="_blank"
rel="noopener noreferrer"
>
만족도 조사하기
</a>
</p>
<a
href="https://forms.gle/fAQ9yoNTyQvdY4q59"
className="text-heading6-M select-none underline text-primary-400"
target="_blank"
rel="noopener noreferrer"
>
만족도 조사하기
</a>
</div>
<div className="flex items-center gap-1 mt-8 justify-end">
<div>
Expand Down
24 changes: 20 additions & 4 deletions src/app/outAccept/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,29 @@ const OutAccept = () => {
</Button>
{selectedTab ? (
<div className=" flex gap-5">
<Dropdown type="all" onChange={handleGradeChange} />
<Dropdown type="class" onChange={handleClassChange} />
<Dropdown
type="all"
onChange={handleGradeChange}
homeRoom={true}
/>
<Dropdown
type="class"
onChange={handleClassChange}
homeRoom={true}
/>
</div>
) : (
<div className=" flex gap-5">
<Dropdown type="all" onChange={handleGradeChange} />
<Dropdown type="class" onChange={handleClassChange} />
<Dropdown
type="all"
onChange={handleGradeChange}
homeRoom={true}
/>
<Dropdown
type="class"
onChange={handleClassChange}
homeRoom={true}
/>
</div>
)}
</>
Expand Down

0 comments on commit b5f64de

Please sign in to comment.