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์ฃผ์ฐจ JS ๐Ÿ‘‰ TS ] ๐Ÿ’– ๊บ„์•„ใ…ใ…๋„ˆ๋ฏ€ ๊ท€์—ฌ์›Œ ๐Ÿ’– #9

Merged
merged 12 commits into from
Jun 28, 2022

Conversation

Happhee
Copy link
Collaborator

@Happhee Happhee commented May 26, 2022

โœจ ๊ตฌํ˜„ ๊ธฐ๋Šฅ ๋ช…์„ธ

JS ๐Ÿ‘‰ TS ๋กœ ๋ณ€ํ™˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค!

๐ŸŽ PR Point

  • page ๋‚˜๋ˆŒ๋•Œ, Error404, Intro, WorldCup, Result ์ด 4๊ฐœ๋กœ ์„ค์ •ํ•˜์˜€์Šด๋Œœ

  • styled.d.ts์— ์ •์˜ํ• ๋•Œ, fonts ๋Š” css๋ฅผ ๋ฐ˜ํ™˜ํ•ด์„œ ThemedCssFunction๋กœ ํƒ€์ž… ์ •์˜ํ•˜์˜€์Šด๋Œœ

  • ๊ณตํ†ต์ ์ธ Header๋ฅผ์ œ์™ธํ•œ ๋ถ€๋ถ„๋“ค์„ component๋กœ ๋ถ„๋ฆฌํ•˜์˜€์Šต๋‹ˆ๋Œœ!

  • handler๋ฅผ ์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ์—์„œ ๋„˜๊ฒจ์ฃผ๋Š” ๋ฐฉ๋ฒ•์„ ์ ๊ทนํ™œ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค!!

-EmoticonItem์„ interface๋กœ ์ •์˜ํ•ด ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋Œœ!

๐Ÿ˜ญ ์–ด๋ ค์› ๋˜ ์ 

ํ•ฉ์„ธ๋„ ํƒ€์“ฐ๋กœ ํ•ด์„œ ์ด์ œ ์‚ด์ง ์–ด๋Š์ •๋„ ์ตํ˜€์ง„๊ฒƒ๊ฐ™์•„์—ฌ!!!

ํ•˜์ง€๋งŒ,,,๋ถ„๋ช… ํ—ˆ์ ์ด ์žˆ์„๊ฑฐ๋ผ ์ƒ๊ฐํ•˜๊ธฐ์—,,,, ํ”ผ๋“œ๋ฐฑ ๋‹คใ…ใ…ใ…๋ฐ›๊ณ ์‹ถ์Šด๋‹ˆ๋‹คใ… ใ… ใ…กใ… ใ…กใ… 

@Happhee Happhee self-assigned this May 26, 2022
@Happhee Happhee requested a review from say-young516 May 26, 2022 09:16
@github-actions
Copy link

์˜ค๋Š˜๋„ ํ• ํ• ๋†€๋†€์„ ๋ชธ์†Œ ์‹ค์ฒœ ์ค‘์ธ ์›นํŒŒํŠธ์› ! ํ™”์ดํŒ… :)
๊ณผ์ œ ๋ ˆํผ๋Ÿฐ์Šค ์ฐธ๊ณ ํ•ด์„œ ๋น ํŠธ๋ฆฐ ๋ถ€๋ถ„์€ ์—†๋Š” ์ง€ ์ฒดํฌํ•ด๋ณผ๊นŒ์š”?

Copy link

@joohaem joohaem 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 +5 to +9
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
Copy link

Choose a reason for hiding this comment

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

๐Ÿคฉ๐Ÿคฉ๐Ÿคฉ๐Ÿคฉ

Comment on lines +4 to +8
interface HeaderProps {
title?: string;
round?: number[];
}
export default function Header(props: HeaderProps) {
Copy link

Choose a reason for hiding this comment

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

Header ์žฌ์‚ฌ์šฉ ์ข‹๋‹ค !!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๊ทธ์น˜๊ทธ์น˜๊ทธ์น˜!!!!!!!!!!!! ํ—ค๋” ์žฌ์‚ฌ์šฉ ์กฐ์•„~>.<

Comment on lines 9 to 13
const handleClick = () => navigate('/worldCup');
return (
<StIntroWrapper>
<StContentImg imgUrl={mainImageUrl} />
<StGameButton onClick={handleClick}>GAME START</StGameButton>
Copy link

Choose a reason for hiding this comment

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

navigate ๋ฐ–์— ๊ธฐ๋Šฅ์ด ์—†๋‹ค๋ฉด, Link ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๊ฒŒ ์ข€ ๋” ์›นํ‘œ์ค€์— ์ ํ•ฉํ•  ๊ฒƒ ๊ฐ™๋‹น

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์›นํ‘œ์ค€์— ์ ํ•ฉํ•˜๋‹ค๋Š” ๋ง์ด ์–ด๋–ค ๋œป์ธ์ง€ ์„ค๋ช…ํ•ด์ค„์ˆ˜์ž‡๋‚˜์•„?!

Copy link

Choose a reason for hiding this comment

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

์›นํ‘œ์ค€์€ HTML, CSS ๋“ฑ์— ๋Œ€ํ•œ WC3๊ทœ๊ฒฉ(๋ฌธ๋ฒ•) ์ค€์ˆ˜ ๋“ฑ์„ ๋งํ•˜๊ณ , ์›น์˜ ์‚ฌ์šฉ์„ฑ ๋ฐ ์ ‘๊ทผ์„ฑ์„ ๋ณด์žฅํ•ด์ค„ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์„ค๋ช…ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค-

navigate์˜ ๋™์ž‘์„ ํ•จ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ๊ธฐ๋ณธ button ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•œ ๊ฑด HTML์˜ ๋ฌธ๋ฒ•์— ์ ํ•ฉํ•˜์ง€ ์•Š๋Š”๋‹ค๊ณ  ์ƒ๊ฐํ•ด
a ํƒœ๊ทธ์™€ ์ด์— ๋งž๋Š” Link ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์›น์˜ ์‚ฌ์šฉ์„ฑ์„ ๋†’์ผ ์ˆ˜ ์žˆ์œผ๋‹ˆ๊นŒ ๋ง์ด์ง€!!

์ฝ์–ด๋ณด๋ฉด ์ข‹์„ ์ฐธ๊ณ  ๋ฌธ์„œ

const navigate = useNavigate();

const handleClickImage = (emoticon: EmoticonItem) => (event: React.MouseEvent<HTMLDivElement>) => {
const image = event.target as HTMLDivElement;
Copy link

Choose a reason for hiding this comment

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

as ๋ง๊ณ  ๋‚ด๋กœ์ž‰์„ ์‹œ์ผœ์ฃผ๋Š” ๊ฑด ์–ด๋–จ๊นŒ์šฅ!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if (event.target instanceof HTMLDivElement) {
      const image = event.target;
      image.classList.add('imageClick');

      setTimeout(() => {
        image.classList.remove('imageClick');
        if (emoticons.length > 2) {
          handleWinners([...winners, emoticon]);
          handleEmoticons(emoticons.slice(2));
          handleRound([round[0] + 1, round[1]]);
        } else {
          if (winners.length === 0) {
            navigate('/result', { state: emoticon });
          } else {
            const nextStepEmoticon = [...winners, emoticon];
            handleEmoticons(nextStepEmoticon);
            handleWinners([]);
            handleRound([1, round[1] / 2]);
            if (round[1] / 2 === 2) handleTitle('์ค€๊ฒฐ์Šน');
            if (round[1] / 2 === 1) handleTitle('๊ฒฐ์Šน');
          }
        }
      }, 1000);
    }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋ฐ”๊บผ๋”ฐ ใ…Žใ……ใ…Ž

Comment on lines +21 to +26
<StFirecrackerImg imgUrl={leftFirecracker} position={'20%'} />

<StArticleImg imgUrl={state.url}>
<StArticleTitle>{state.name}</StArticleTitle>
</StArticleImg>
<StFirecrackerImg imgUrl={rightFirecracker} position={'80%'} />
Copy link

Choose a reason for hiding this comment

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

'20%', '80%' ๋กœ position ๊ฐ’์„ ์ง์ ‘ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜๋ฉด, css ์ฝ”๋“œ์™€ ๋ถ„๋ฆฌ๊ฐ€ ๋˜์ง€ ์•Š๊ฒŒ ๋˜๋Š” ๊ฒƒ ๊ฐ™์•„

๊ทธ๋ž˜์„œ ๋‚˜๊ฐ™์œผ๋ฉด position ๋ณด๋‹ค isright boolean ์ •๋„๋กœ ์ค˜์„œ,

background-position: ${(props) => props.isright ? "80%" : "20%"} center;

์ •๋„๋กœ ์ž‘์„ฑํ•  ๊ฒƒ ๊ฐ™๋„ค!

Choose a reason for hiding this comment

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

WoW~

Comment on lines +8 to +12
interface ResultLocation {
state: EmoticonItem;
}
export default function ResultMain() {
const { state } = useLocation() as ResultLocation;
Copy link

Choose a reason for hiding this comment

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

๐Ÿ‘๐Ÿ‘

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์ด๋Ÿฐ๋ฐ์„œ๋Š” as๋กœ ์ง€์ •ํ•˜๋Š”๊ฒŒ ๋งž๋Š”๊ฑฐ์ง€? ์šฐ๋ฆฌ๊ฐ€ ์„ค์ •ํ•œ ๊ฑฐ๋‹ˆ๊นŒ?!!
๊ทธ๊ฒŒ ์•„๋‹ˆ๋ผ๋ฉฐ๋Š” ๋„ค๋กœ์ž‰์ด ์ ํ•ฉํ•œ๊ฑฐ๊ตฌ?!

Copy link

Choose a reason for hiding this comment

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

๊ทธ๋ ‡๊ฒŒ ๊ธฐ์ค€์„ ๋‚˜๋ˆŒ ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค !!
๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค๊ธฐ๋ณด๋‹ค useLocation ํ›…์˜ ํƒ€์ž… ๋ช…์‹œ๋ฅผ ํ•ด์ฃผ๋Š” ๊ฒŒ ๋”ฐ๋กœ ์ œ๊ณต๋˜์ง€ ์•Š์•„์„œ as ์‚ฌ์šฉํ•˜๋Š” ๋‚ด์šฉ๋“ค๋ฐ–์— ๋ชป์ฐพ๋Š” ๊ฒƒ๋„ ์žˆ๊ฒ ๊ตฌ!

Choose a reason for hiding this comment

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

๋ฐฐ์›Œ๊ฐ‘๋‹ˆ๋‹ค์•™ ~

Comment on lines 14 to 15
{title !== undefined ? `${title}` : ''}
{round !== undefined ? ` ${round[0]}/${round[1]}` : ''}
Copy link

Choose a reason for hiding this comment

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

Suggested change
{title !== undefined ? `${title}` : ''}
{round !== undefined ? ` ${round[0]}/${round[1]}` : ''}
{title && `${title}`}
{round && ` ${round[0]}/${round[1]}`}

์ •๋„๋กœ ๋  ์ˆ˜ ์žˆ์œผ๋ ค๋‚˜-

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ํ‚ค์•ผ์˜คํ‚ค

@github-actions
Copy link

์˜ค๋Š˜๋„ ํ• ํ• ๋†€๋†€์„ ๋ชธ์†Œ ์‹ค์ฒœ ์ค‘์ธ ์›นํŒŒํŠธ์› ! ํ™”์ดํŒ… :)
๊ณผ์ œ ๋ ˆํผ๋Ÿฐ์Šค ์ฐธ๊ณ ํ•ด์„œ ๋น ํŠธ๋ฆฐ ๋ถ€๋ถ„์€ ์—†๋Š” ์ง€ ์ฒดํฌํ•ด๋ณผ๊นŒ์š”?

@Happhee
Copy link
Collaborator Author

Happhee commented May 30, 2022

์„ธ์‹ฌํ•œ ์ฝ”๋“œ๋ฆฌ๋ทฐ ๊ฐ์Ÿˆํ•ฉ๋‹ˆ๋‹ค ใ…Žใ……ใ…Ž ๋•๋ถ€๋„ค ํƒ€์“ฐ ๊ธˆ๋ฐฉ์ €๊ธ์™•๋ฃŒ์˜ค

@github-actions
Copy link

์˜ค๋Š˜๋„ ํ• ํ• ๋†€๋†€์„ ๋ชธ์†Œ ์‹ค์ฒœ ์ค‘์ธ ์›นํŒŒํŠธ์› ! ํ™”์ดํŒ… :)
๊ณผ์ œ ๋ ˆํผ๋Ÿฐ์Šค ์ฐธ๊ณ ํ•ด์„œ ๋น ํŠธ๋ฆฐ ๋ถ€๋ถ„์€ ์—†๋Š” ์ง€ ์ฒดํฌํ•ด๋ณผ๊นŒ์š”?

Copy link

@henization henization left a comment

Choose a reason for hiding this comment

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

ํด๋”๊ตฌ์กฐ ๊น”๋”.. ์ƒˆ๋กœ์šด๊ฑฐ ํ•ญ์ƒ ๊ผญ์‹œ๋„ํ•จ... ์ง„์งœ ์ตœ๊ณ ๋‹ค ํ™์„œํžˆ~~~ ๐Ÿฐ

render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

Choose a reason for hiding this comment

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

test ์ฝ”๋“œ !!!!! ์งฑ์ธ๋ฐ~ ~

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ใ…Žใ…Žใ…Žใ…Ž ์›น์‹ฌํ™”์—์„œ ๋ฐฐ์› ์ง€ ใ…Žใ…Ž

declare module '*.jpg';
declare module '*.png';
declare module '*.jpeg';
declare module '*.gif';

Choose a reason for hiding this comment

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

ํƒ€์Šค์—์„œ๋Š” .d.ts ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด์ค˜์•ผํ•œ๋‹ค ๋ฌด์ข๊ฑด ๋ช…์‹ฌ..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋‚˜๋„ ๋ช….์‹ฌ.

name: string;
url: string;
}
export const emoticonItems: EmoticonItem[] = [

Choose a reason for hiding this comment

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

์ด ๋ถ€๋ถ„ ์ฃผํ•จ์ด ๋‚ด ์ฝ”๋“œ๋ฆฌ๋ทฐํ•  ๋•Œ ์–˜๊ธฐํ–ˆ๋˜ ๊ฒƒ์ฒ˜๋Ÿผ ๋‹ค๋ฅธ ํด๋”์— ์ •์˜ํ•ด์„œ export ์‹œํ‚ค๋Š”๊ฒŒ ์˜๋ฏธ ๋ถ„๋ฆฌ์— ๋” ์ข‹์„ ๊ฑฐ ๊ฐ™์•„์šฉ!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋งˆ์ž๋งˆ์ž ใ…Žใ…Žใ…Ž ๋ฆฌ๋ทฐ๋๋‚˜๊ณ  ์ˆ˜์ •ํ•ด๋ณผ๋ผ๊ตฌ ใ…Žใ…Ž
๋‹ค์‹œ ํ•œ๋ฒˆ ์งš์–ด์ค˜์„œ ๊ณ ๋งˆ์›Œ ใ…Žใ…Ž

<StHeader>๐Ÿ’– ๊บ„์•„ใ…ใ…๋„ˆ๋ฏ€ ๊ท€์—ฌ์›Œ ๐Ÿ’–</StHeader>
<StSubHeader>
{title && `${title}`}
{round && ` ${round[0]}/${round[1]}`}

Choose a reason for hiding this comment

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

์ด๋Ÿฐ์‹์œผ๋กœ Header๋ฅผ Intro์—์„œ๋„ ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ–ˆ๊พธ๋งŒ!! ์งฑ์งฑ~

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋งˆ์Ÿˆ์—ฌ!!!!!>.<

round?: number[];
}
export default function Header(props: HeaderProps) {
const { title, round } = props;

Choose a reason for hiding this comment

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

๊ตฌ์กฐ๋ถ„ํ•ดํ• ๋‹น ์งฑ~

overflow: hidden;

.imageClick {
animation: ${imageClick} 0.4s infinite linear alternate;

Choose a reason for hiding this comment

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

์• ๋‹ˆ๋ฉ”์ด์…˜ ์งฑ~

animation: ${imageClick} 0.4s infinite linear alternate;
}
`;
const StArticleImg = styled.div<{ imgUrl: string }>`

Choose a reason for hiding this comment

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

์ด๋ฏธ์ง€ props ์ด๋ ‡๊ฒŒ ๋ฐ›์•„์™€์„œ ์“ฐ๋Š”๊ตฌ๋งŒ!! ๋งน์‹ฌํ•˜๊ฒ ์–ด

Comment on lines +8 to +12
interface ResultLocation {
state: EmoticonItem;
}
export default function ResultMain() {
const { state } = useLocation() as ResultLocation;

Choose a reason for hiding this comment

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

๋ฐฐ์›Œ๊ฐ‘๋‹ˆ๋‹ค์•™ ~

Comment on lines +21 to +26
<StFirecrackerImg imgUrl={leftFirecracker} position={'20%'} />

<StArticleImg imgUrl={state.url}>
<StArticleTitle>{state.name}</StArticleTitle>
</StArticleImg>
<StFirecrackerImg imgUrl={rightFirecracker} position={'80%'} />

Choose a reason for hiding this comment

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

WoW~

declare module 'styled-components' {
export interface DefaultTheme {
fonts: {
header: ThemedCssFunction;

Choose a reason for hiding this comment

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

ํŒ…๊ธฐํ•ด์—ฌ!!!

Choose a reason for hiding this comment

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

์ด๋Ÿฐ ํƒ€์ž…๋ช…๋„ ์žˆ๊ตฌ๋‚˜

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋‚˜๋„ ์‹ฑ๊ธฐํ•ด >.<

@Happhee Happhee merged commit ed8ca1c into main Jun 28, 2022
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.

3 participants