Skip to content
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

feat: 사용자 전적 페이지 (사용자 지정 게임의 1 VS 1 모드 개요 페이지) css 구현 #61

Conversation

nyj001012
Copy link
Collaborator

@nyj001012 nyj001012 commented Jan 16, 2024


공통

  • 페이지의 헤더는 공통 모듈로 관리하여 common에서 관리합니다.
  • css와 이미지, 폰트는 frontend/assets에서 관리합니다.
  • 몇 가지 assets/ 리소스를 추가했습니다.
  • index.html에 mini reset css를 적용하여 브라우저의 css를 초기화했습니다.

Header

  • /histories...를 제외한 곳에서는 모두 공통 헤더를 사용하게 했습니다.
  • /histories...에 해당하는 헤더는 전적 페이지 전용 헤더를 사용합니다.

Body

  • body에 모든 페이지를 통틀어 적용할 공통 css를 추가했습니다.

사용자 전적 페이지 (사용자 지정 게임의 1 VS 1 모드 개요 페이지)

  • 사용자의 전적 데이터를 받아와 렌더링하는 함수를 구현했습니다.

미리보기

화면 기록 2024-01-18 오후 2 57 55


@nyj001012 nyj001012 added enhancement New feature or request frontend frontend 관련 PR labels Jan 16, 2024
@nyj001012 nyj001012 self-assigned this Jan 16, 2024
@nyj001012 nyj001012 marked this pull request as ready for review January 18, 2024 05:42
@nyj001012
Copy link
Collaborator Author

미리보기 gif 파일에 이상한 타일무늬가 보이긴 하는데, 실제로는 무늬가 없습니다

@donghyun1998
Copy link
Contributor

a태그 사용하시는 부분에 새로고침 안되게 preventdefault() 이벤트리스너 달아주시면 좋을 것 같습니다.
hover나 onclick같은 이벤트 핸들러는 이벤트 리스너와 달리 1개만 적용가능합니다. 2개적용하면 덮어씌워집니다.
단순한 css변경하는 부분에선 코드 양 적은 이벤트핸들러 사용도 좋아보입니다.
현재 페이지에서 header와 달리 app에선 ajax요청을 통해 기록을 받아오게 될 텐데 app 부분의 레이아웃만 먼저 렌더링 되고 이후에 기록 렌더링 되게 해서 header와 app레이아웃 동시에 렌더링되게 잘 해주신 것 같습니다!

@nyj001012 nyj001012 marked this pull request as draft January 18, 2024 06:25
@nyj001012 nyj001012 marked this pull request as ready for review January 18, 2024 08:35
Copy link
Contributor

@donghyun1998 donghyun1998 left a comment

Choose a reason for hiding this comment

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

너무 좋은데요!!!! 고생하셨습니다

Comment on lines +2 to +58
* 마우스 hover 시 폰트 색상 변경
* @param element hover 효과를 넣고 싶은 html 엘리먼트
* @param originalColor 원래 색상
* @param hoverColor hover 시 색상
*/
export const hoverChangeColor = (element, originalColor, hoverColor) => {
element.addEventListener("mouseover", () => {
element.style.color = hoverColor;
});
element.addEventListener("mouseout", () => {
element.style.color = originalColor;
});
}

/**
* 마우스 hover 시 폰트 변경
* @param element hover 효과를 넣고 싶은 html 엘리먼트
* @param originalFont 원래 폰트
* @param hoverFont hover 시 폰트
*/
export const hoverChangeFont = (element, originalFont, hoverFont) => {
element.addEventListener("mouseover", () => {
element.style.fontFamily = hoverFont;
});
element.addEventListener("mouseout", () => {
element.style.fontFamily = originalFont;
});
}

/**
* 마우스 hover 시 border 변경
* @param element hover 효과를 넣고 싶은 html 엘리먼트
* @param originalBorder 원래 border
* @param hoverBorder hover 시 border
*/
export const hoverChangeBorder = (element, originalBorder, hoverBorder) => {
element.addEventListener("mouseover", () => {
element.style.border = hoverBorder;
});
element.addEventListener("mouseout", () => {
element.style.border = originalBorder;
});
}

/**
* 마우스 hover 시 cursor 변경
* @param element hover 효과를 넣고 싶은 html 엘리먼트
* @param cursor hover 시 cursor
*/
export const hoverChangeCursor = (element, cursor) => {
element.addEventListener("mouseover", () => {
element.style.cursor = cursor;
});
element.addEventListener("mouseout", () => {
element.style.cursor = "default";
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

너무 좋은데요 재사용하기 좋을 것 같습니다

Copy link
Contributor

Choose a reason for hiding this comment

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

@param {HTMLElement} element hover 효과를 넣고 싶은 html 엘리먼트

jsdoc 작성하실 때 이렇게 param과 변수명 사이에 { 자료형 } 넣어줄 수 있습니다!

Comment on lines +184 to +205
hoverChangeColor(summary, "#ffffff", "#29ABE2");
hoverChangeColor(custom, "#ffffff", "#29ABE2");
hoverChangeColor(tournament, "#ffffff", "#29ABE2");

// 폰트 변경
hoverChangeFont(summary, "Galmuri11, serif", "Galmuri11-Bold, serif");
hoverChangeFont(custom, "Galmuri11, serif", "Galmuri11-Bold, serif");
hoverChangeFont(tournament, "Galmuri11, serif", "Galmuri11-Bold, serif");

// 커서 변경
hoverChangeCursor(summary, "pointer");
hoverChangeCursor(custom, "pointer");
hoverChangeCursor(tournament, "pointer");
hoverChangeCursor(prev, "pointer");
hoverChangeCursor(next, "pointer");

// click 이벤트
click(summary, function () {console.log("TODO => 개요 페이지로 이동")});
click(custom, function () {console.log("TODO => 사용자 지정 모드 페이지로 이동")});
click(tournament, function () {console.log("TODO => 토너먼트 모드 페이지로 이동")});
click(prev, function () {console.log("TODO => 이전 페이지로 이동")});
click(next, function () {console.log("TODO => 다음 페이지로 이동")});
Copy link
Contributor

Choose a reason for hiding this comment

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

코드 길이가 엄청 줄어드네요 이벤트리스너 함수 추상화 하신 것 너무 마음에 듭니다!

@nyj001012
Copy link
Collaborator Author

jsdoc 쓸 때 params 타입 명시
@params { type } [description]

Copy link
Contributor

@bluedog129 bluedog129 left a comment

Choose a reason for hiding this comment

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

앞으로 사용해야할 아바타, 설정 등의 아이콘 아주 좋습니다~
css를 링크하는 방식(모두가 사용하는 것과 해당하는 페이지에서만 사용할 때 적용할 때를 구분)과
사용자 전적에 페이지 렌더링과 hover 이벤트에 대한 코드 앞으로 잘 참고해서 사용하겠습니다!

@nyj001012 nyj001012 merged commit cac68b4 into main Jan 18, 2024
1 check passed
@nyj001012 nyj001012 deleted the 60-유저-정보-페이지사용자-지정-모드-목록-기본-css-구현 branch January 18, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend frontend 관련 PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

유저 정보 페이지(사용자 지정 모드 목록 기본) css 구현
3 participants