Skip to content

Sort PR#5

Open
SeungJoo-Han wants to merge 8 commits into
kucc:mainfrom
SeungJoo-Han:Sort
Open

Sort PR#5
SeungJoo-Han wants to merge 8 commits into
kucc:mainfrom
SeungJoo-Han:Sort

Conversation

@SeungJoo-Han

Copy link
Copy Markdown

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

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

@vercel

vercel Bot commented Nov 21, 2023

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Nov 21, 2023

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Author

Choose a reason for hiding this comment

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

수정 했어요!

Comment thread src/recoil/main.ts
}) No newline at end of file
})

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

Copy link
Copy Markdown
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 = "타이틀순" | "학점순" | "난이도순"

Comment thread src/constants/sort.ts
'타이틀순',
'학점순',
'난이도순',
]; No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
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
Copy Markdown
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