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

[3주차-ts] 이상형월드컵 자스👉타스 #6

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

Conversation

say-young516
Copy link
Member

➰이상형월드컵 - TS➰

일단 돌아가긴 하는데 여태 스터디한 자료 왔다갔다 하면서 해가지구 하나 둘 엉성하거나 빠트린 게 있을 것 같은 느낌인데 한 번 봐주십셔

Copy link

@Happhee Happhee left a comment

Choose a reason for hiding this comment

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

그래두 뚝딱뚝딱 잘하는댜?!! Router도 설정해보는거 추천하구!! theme두~!!

Comment on lines +8 to 11
return (
<>
<GlobalStyle/>
<Game/>
Copy link

Choose a reason for hiding this comment

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

      <ThemeProvider theme={theme}>

theme도 적용해봤으면 좋겠구! GlobalStyle은 components폴더가 아니라 styles 폴더가 따로 있어야 할것같아!

Comment on lines 29 to 33
interface Img{
src:string;
title:string;
onClick:React.MouseEventHandler<HTMLDivElement>;
}
Copy link

Choose a reason for hiding this comment

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

interface 명이 조금더 정확했슴 좋겠어! 뭔가 태그명으로 <Img>가 있으니까?! ImgProperty라던가~.~

Copy link
Member Author

Choose a reason for hiding this comment

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

interface 명이 조금더 정확했슴 좋겠어! 뭔가 태그명으로 <Img>가 있으니까?! ImgProperty라던가~.~

앗 맞네 그냥 이미지 관련이라 이렇게 지었는데 그게 더 명확하겠다~! 의견 고마오!

Comment on lines +1 to +4
declare module "*.jpg";
declare module "*.png";
declare module "*.jpge";
declare module "*.gif";
Copy link

Choose a reason for hiding this comment

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

custom.d.ts도 네이밍이 명확하지는 않은것같아!

customImg.d.ts 도 나쁘지는 않은듯!

Comment on lines +65 to +70
const [fighterList, setFighterList] = useState<Icecream[]>([]); //처음에 세팅되는 모든 참가자 배열
const [winners, setWinners] = useState<Icecream[]>([]); //해당 라운드 승리자 저장 배열
const round = useRef<number>(1); //지금 진행한 경기 횟수
const [gameEnd, setGameEnd] = useState<boolean>(false); //게임이 끝났는지 여부
const remain = useRef<number>(0); //남아있는 경기 횟수
const [realWinner, setRealWinner] = useState<Icecream>({img:"",name:""}); //최종 승리자
Copy link

Choose a reason for hiding this comment

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

hook 타입 지정 굳굳🔥

Comment on lines 40 to 43
export interface Icecream{
img:string;
name:string;
}
Copy link

Choose a reason for hiding this comment

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

export 를 component에서 하는 것보다 따로 type폴더를 만들어서 선언해주면 더 조을것가타!

Copy link
Member Author

Choose a reason for hiding this comment

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

export 를 component에서 하는 것보다 따로 type폴더를 만들어서 선언해주면 더 조을것가타!

호곡 마저,, 사실 고칠 때 저 interface 를 어느 컴포넌트에 적어놨는지 헷갈려서 이리저리 헤맸는데,, 왜 이 생각을 못했지?!?!?!??! 당장 고쳐야지,,

import 왕관 from "../img/왕관.png";
import { Icecream } from './Game';
Copy link

Choose a reason for hiding this comment

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

그렇게 데면 요기서 Icecream을 Game에서 불러오는게 아니라 type 에서 불러오게찌?

Comment on lines 51 to 55
function Result( { winner} :IcecreamProps) {
return (
<ResultContainer>
<p style={{ fontSize: "1.5rem" }}>우승자!</p>
<h1 style={{ fontSize: "3rem", fontWeight: "bold" }}>{winner.name}</h1>
<Winner>우승자!</Winner>
<WinnerName>{winner.name}</WinnerName>
Copy link

Choose a reason for hiding this comment

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

요사이에

Suggested change
function Result( { winner} :IcecreamProps) {
return (
<ResultContainer>
<p style={{ fontSize: "1.5rem" }}>우승자!</p>
<h1 style={{ fontSize: "3rem", fontWeight: "bold" }}>{winner.name}</h1>
<Winner>우승자!</Winner>
<WinnerName>{winner.name}</WinnerName>
function Result( { winner} :IcecreamProps) {
const { name, img } = winner
return (
<ResultContainer>
<Winner>우승자!</Winner>
<WinnerName>{name}</WinnerName>

구조분해 할당도 사용가능하다는거!-!

Copy link
Member Author

Choose a reason for hiding this comment

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

요사이에

구조분해 할당도 사용가능하다는거!-!

훨씬 깔끔하다!! 요렇게 수정 완료~~~

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