-
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
[2주차 기본/심화/공유 과제] 관리자 페이지 #3
base: main
Are you sure you want to change the base?
Conversation
@import url("https://fonts.googleapis.com/css2?family=Jua&display=swap"); | ||
|
||
* { | ||
font-family: "Jua", sans-serif; |
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.
p5: 폰트가 귀여워요 👍
} from "./modules/checkboxHandlers.js"; | ||
import { setupModalHandlers, closeModal } from "./modules/modalHandlers.js"; | ||
import { setupFormHandler } from "./modules/modalFormHandlers.js"; | ||
import { deleteCheckedRows } from "./modules/deleteHandler.js"; |
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.
p5: 저는 js를 하나의 파일에 다 작성했는데, 건휘님처럼 modules 폴더에 각각의 기능에 맞게 나누어 작성한 게 정말 좋은 것 같아요! 보기에도 훨씬 깔끔하고, 나중에 코드 유지 보수하기에도 더 편리할 것 같습니다.
} | ||
|
||
const englishName = document.getElementById("englishName").value; | ||
if (!englishRegex.test(englishName)) { |
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.
p5: 영문이름과 깃허브에서 유효성 검사를 수행하는 섬세함이 돋보입니당
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.
그러게요 ! 유효성 검사까지 신경 쓰신 부분 .... 디테일하셔라 ......🫠🫠👍
firstWeekGroup: parseInt( | ||
document.getElementById("firstWeekGroup").value, | ||
10 | ||
), |
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.
p5: firstWeekGroup과 secondWeekGroup의 값을 parseInt를 사용하여 정수로 변환한 점이 인상적인 것 같아요. 사용자가 입력한 값을 안전하게 정수형으로 변환함으로써, 이후의 계산이나 비교에 문제가 발생하지 않도록 해주고 있는 거 겠죠..? 사람 수는 소수점으로 나올 수 없으니까, 세심하게 모든 부분을 고려하신 것 같아요 !!
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.
안녕하세요 ~ 건휘님 !
2주차 과제 너무 고생 많으셨습니다 🍀
폼의 유효성 검사까지 꼼꼼히 챙기신 부분이 인상 깊었고, every나 test 같이 다양한 메서드들을 잘 활용하셔서 많이 배우고 갑니다 !!
그리고 PR에 남겨주신 멤버 데이터 삭제후, 다른 멤버 추가 시 처음에 삭제했던 데이터가 다시 불러와지는 문제가 아직도 발생하고 있는 것 같습니다. 관련 로직 한번 더 체크해보시면 좋을 것 같습니다 😮
저도 코드를 보긴 했는데 이유를 모르겠습니다 ......... ㅎ.ㅎ
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.
모든 로직은 각 파일 내에서 담당하고, index.js
에는 핸들러 함수를 불러와서 사용하는 식으로 하셨네요 !
가독성 측면에서 좋은 것 같습니다 👍
@@ -0,0 +1,18 @@ | |||
export function openModal(modal) { |
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.
현재 코드에는 모달을 열 때 입력된 필드 값을 초기화하는 부분이 없는 것 같아요. 이 부분 때문에 멤버를 추가한 뒤 다시 모달을 열어서 다른 멤버 데이터를 추가하고자 할 때 이전에 입력했던 내용이 그대로 남아 있는 것 같아요 ..!
- openModal 함수 안에 모달 열기 전에 폼을 초기화하는 로직을 추가해주기
- 별도의 초기화 함수로 분리한 후 setupModalHandlers에서 모달을 열 때마다 호출되도록 하기
두 가지 방법으로 해당 이슈를 해결할 수 있을 것 같습니다 !
} | ||
|
||
const englishName = document.getElementById("englishName").value; | ||
if (!englishRegex.test(englishName)) { |
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.
그러게요 ! 유효성 검사까지 신경 쓰신 부분 .... 디테일하셔라 ......🫠🫠👍
if (event.target.type === "checkbox") { | ||
const allChecked = Array.from( | ||
tbody.querySelectorAll('input[type="checkbox"]') | ||
).every((checkbox) => checkbox.checked); |
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.
저는 체크박스 로직이 과제에서 가장 어려운 부분이었는데요 ..
갯수 비교를 통해 전체 체크박스의 on off를 체크했는데 every 메서드를 사용할 수도 있었네요 ..!!
} | ||
|
||
.btn-container button { | ||
width: 49%; |
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.
width를 49%로 지정해서 버튼 간의 갭을 주는 것 보다, width: 100%로 지정하고 flex-grow 속성을 준 뒤 gap을 직접적으로 지정하는 게 반응형에서 더 유연하게 반응할 것 같습니당 !
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; |
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.
p5: 저는 display:flex;를 써서 했는데, grid-template-columns: 1fr 1fr 1fr;라고 설정하면 총 가용 공간이 3개의 열로 동일하게 나뉘어 각 열이 전체 공간의 1/3을 차지하게 되므로 gird로 주는 게 정확히 3등분 하는 데에 더 적합한 것 같네요 ! 배웠습니당
@@ -0,0 +1,22 @@ | |||
export function handleCheckAll(checkAll, tbody) { |
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.
justify-content: center; | ||
width: 8rem; | ||
height: 3rem; | ||
flex-shrink: 0; |
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.
p5: 아직은 저에게 조금 낯선 스타일이라 건휘님 코드에서 보고 한 번 더 공부할 수 있었습니다 !!
여기서 이 스타일을 주신 이유가 있을까요..?
left: 50%; | ||
transform: translate(-50%, -50%); | ||
background-color: white; | ||
padding: 20px; |
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.
p5: 소소한 궁금증이 있는데 어떨 때 px를 쓰고 어떨 때 rem을 쓰는지 알 수 있을까요? 지난주에는 reset.css에서 font-size를 62.5%로 설정하고 단위를 rem으로 통일해 달라고 하셨는데, 통일하다 보니 어느 정도의 단위까지 rem을 사용하는 게 좋을지 고민되더라고요. 저번 프로젝트에서는 어떤 방법으로 단위 사용을 통일하셨었는지 궁금합니당
안녕하세요 건휘님! 그리고 건휘님이 JS 파일을 모듈로 나누어 관리하셔서 코드 가독성도 훨씬 좋고 파일 구조도 깔끔해진 것 같아요! 또, 저는 아직도 커밋 메시지를 고민하다가 적곤 하는데, 건휘님 커밋 메시지는 정말 알아보기 쉽게 쓰여 있는 것 같아서 OB의 노련함이 엿보입니다 !!ㅎㅎㅎ 금잔디 조장님이자 나리스 조장님, 앞으로도 많이 배우겠습니다! 👍 |
✨ 구현 기능 명세
💡 기본 과제
데이터
헤더
필터
(기본과제에서는 7개 모두 input으로 구현해도 괜찮음)
표
선택삭제
,추가
버튼이 위치선택삭제
버튼 클릭 시, 체크된 항목들 삭제추가
버튼 클릭 시, 항목 추가 모달 등장모달
닫기
버튼추가
버튼 클릭 시, 모달 닫히면 데이터 추가🔥 심화 과제
필터
표
모달
공유과제
제목: Webpack & Babel
링크 첨부 : https://wave-web.tistory.com/60
❗️ 내가 새로 알게 된 점
삭제 로직에서
index
를 기준으로 처리하게되면, 순차적으로 삭제를 하는 상황이면 괜찮은데 중간에 있는 데이터를 삭제하게 되는 경우index
가 꼬여서 원치 않는 데이터가 삭제되고 삭제하고 싶은 데이터는 그대로 남아있는 문제가 발생할 수 있다.=> 각 데이터 객체에 고유한
ID.
즉,ID
값을 사용해 정확한 데이터를 삭제하는 방식으로 진행하여야한다.❓ 구현 과정에서의 어려웠던/고민했던 부분
멤버 데이터 삭제후, 다른 멤버 추가로 삭제시 처음에 삭제했던 데이터가 다시 불러와지는 문제
기존 코드에서는 멤버를 삭제할 때는
updatedData
로 필터링하여 렌더링하고 로컬 스토리지를 갱신하고 있는데,data
변수는 여전히 초기 상태를 참조하고 있기 때문에 이후 삭제 시 문제가 발생하고 있었다.해결 방법
data
변수를 삭제 후 최신 상태로 동기화🥲 소요 시간
12h
🖼️ 구현 결과물
https://living-headstand-8f1.notion.site/2-12e205f6a105800c95b6c196eb1f1605