Skip to content

Sort PR #5

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Sort PR #5

wants to merge 8 commits into from

Conversation

SeungJoo-Han
Copy link

타이틀/학점/난이도 순 정렬 버튼입니다.

버튼 간격이 없어서 style 조금 수정했는데 확인해보시고 바꾸시려면 바꾸시는게 좋을거 같아요.

Copy link

vercel bot commented Nov 21, 2023

@SeungJoo-Han is attempting to deploy a commit to the KUCC Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Nov 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
official-kucc-check ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2023 7:50am

for (let i = 0; i<sortArray.length ; i++){
if(sortArray[i].difficulty === "hard"){
newSortArray.push(sortArray[i])
}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const difficultyList = ["easy", "medium", "hard"] 라는 배열을 만들어서 중복을 줄일 수 있을 거 같아요!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정 했어요!

})

export const sortCourseState = atom<string | null>({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sortCourseState와 같은 경우에는 일반적인 string 보다는 특수한 string이 오는 케이스이니, string literal을 쓰면 더 좋을 거 같아요. ex ) type SortCourse = "타이틀순" | "학점순" | "난이도순"

'타이틀순',
'학점순',
'난이도순',
];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런식으로 상수 정리하시는 습관 너무 좋습니다 :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아까 타입과 관련해서 type SortCourse = "타이틀순" | "학점순" | "난이도순"라고 썼었는데, 이런식으로 상수로 정리되어 있다면 배열을 as const로 만들고 배열에서 string literal 타입을 뽑아오는 것도 좋은 패턴입니다!

@SeungJoo-Han
Copy link
Author

difficultyList 만들어서 수정했습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants