Coding Archive

๋…ธ๋งˆ๋“œ ์ฝ”๋” - ์ฝ”์ฝ”์•„ํ†ก ํด๋ก ์ฝ”๋”ฉ ์—ฐ์Šต(6) ๋ณธ๋ฌธ

๐Ÿ–ฅ๏ธ Clone Coding

๋…ธ๋งˆ๋“œ ์ฝ”๋” - ์ฝ”์ฝ”์•„ํ†ก ํด๋ก ์ฝ”๋”ฉ ์—ฐ์Šต(6)

์ฝ”๋“ฑ์–ด 2022. 5. 19. 00:00

CLONING TIME

 

 

33. Write Message Input

reply ์ฐฝ ๋งŒ๋“ค๊ธฐ

2๊ฐœ์˜ column์œผ๋กœ ๊ตฌ์„ฑ

โ–ถ์ฒซ ๋ฒˆ์งธ๋Š” ํ”Œ๋Ÿฌ์Šค ์•„์ด์ฝ˜

โ–ถ๋‘ ๋ฒˆ์งธ๋Š” ์ธํ’‹, ์ด๋ชจ์ง€, ๋ฒ„ํŠผ

์ด๋•Œ ๋‘ ๋ฒˆ์งธ column์˜ input์˜ width๋ฅผ ๋„“ํ˜€์ฃผ๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ถ€๋ชจ์ธ ๋‘ column๊ณผ reply์— width๋ฅผ ์ฃผ์–ด์•ผ ํ•œ๋‹ค.

๋‘ ๋ฒˆ์งธ column์—์„œ ์ด๋ชจ์ง€์™€ ๋ฒ„ํŠผ์„ ์˜ฎ๊ธฐ๊ธฐ ์œ„ํ•ด position: absolute; ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

 

+)

๋„ˆ๋น„ ๋ถ€๋ถ„์ด ์žˆ์–ด์„œ 100%๋ผ๊ณ  ๋งํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ถ€๋ชจ ์ปจํ…Œ์ด๋„ˆ์— ๋„ˆ๋น„๊ฐ€ ํ•„์š”ํ–ˆ์ง€๋งŒ 300px ๋˜๋Š” 500px์™€ ๊ฐ™์ด ์ˆ˜๋™์œผ๋กœ ์ž…๋ ฅ ๋„ˆ๋น„๋ฅผ ์„ค์ •ํ•˜๋ฉด ๋ถ€๋ชจ ์ปจํ…Œ์ด๋„ˆ ๋„ˆ๋น„๋ฅผ ์„ค์ •ํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค.

 

 

34. Splash Screen part One

100vh๋Š” ํ™”๋ฉด ๋†’์ด์˜ 100%, 100vw๋Š” ํ™”๋ฉด ๋„ˆ๋น„์˜ 100%์ด๋‹ค.

 

100vh = The screen's height

100vw = The screen's width

100% = 100% of the PARENT

 

๋ชจ๋“  layer์˜ ์œ„๋กœ ์˜ค๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด์„œ body๋ฅผ ๊ธฐ์ค€์œผ๋กœ position: absolute;

 

 

35. Splash Screen part Two

CSS์˜ keyframes ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ splash ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ค„ ์ˆ˜๋Š” ์žˆ์ง€๋งŒ, ์™„๋ฒฝํ•˜๊ฒŒ ์—†์–ด์ง„ ์ƒํƒœ๋ฅผ ๋งŒ๋“ค ์ˆ˜๋Š” ์—†๋‹ค.

→ CSS์—์„œ visibility: hidden; ์œผ๋กœ HTML์„ ํ™”๋ฉด, ๋งˆ์šฐ์Šค๋กœ๋ถ€ํ„ฐ ์ˆจ๊ธธ ์ˆ˜๋Š” ์žˆ์–ด๋„ ์™„์ „ํžˆ ์‚ฌ๋ผ์ง€๊ฒŒ ํ•˜์ง€ ๋ชปํ•œ๋‹ค.

(์•ˆ ๋ณด์ด๊ฒŒ ํ•  ์ˆœ ์žˆ์ง€๋งŒ ์‹ค์ œ๋กœ๋Š” ์กด์žฌํ•˜๊ณ  ์žˆ๋Š” ์ƒํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— ์™„์ „ํžˆ ์‚ฌ๋ผ์ง€๊ฒŒ ํ•˜๋ ค๋ฉด JavaScript๊ฐ€ ํ•„์š”ํ•˜๋‹ค.)

@keyframes hideSplashScreen {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

 

์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ๋งˆ์ง€๋ง‰ ๊ฐ’์„ ๊ธฐ์–ตํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด forwards๋ผ๋Š” ๋‹จ์–ด๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

→ ๋งˆ์ง€๋ง‰ keyframes๋ฅผ ๊ธฐ์–ตํ•œ๋‹ค.

animation-delay: 2s; ๋ฅผ ์ด์šฉํ•ด ์• ๋‹ˆ๋ฉ”์ด์…˜ ์‹œ์ž‘์„ 2์ดˆ๊ฐ„ ์ง€์—ฐ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

#splash-screen {
  background-color: var(--yellow);
  position: absolute;
  height: 100vh;
  width: 100vw;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 132px;
  animation: hideSplashScreen 0.3s ease-in-out forwards;
  animation-delay: 2s;
}

 

 

36. Navigation Animation

์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ด์šฉํ•ด nav-bar ๋””์ž์ธ

@keyframes notificationAnimation {
  0% {
    transform: none;
  }
  50% {
    transform: translateY(-5px) rotateY(360deg);
  }
  100% {
    transform: none;
  }
}

.nav__notification {
  position: absolute;
  left: 15px;
  bottom: 15px;
  animation: notificationAnimation 2s ease-in-out infinite;
}

@keyframes appearBtnAnimation {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.nav__btn {
  opacity: 0;
  transform: translateY(50px);
  animation: appearBtnAnimation 0.3s ease-in-out forwards;
}

.nav__btn:nth-child(2) {
  animation-delay: 0.2s;
}

.nav__btn:nth-child(3) {
  animation-delay: 0.4s;
}

.nav__btn:last-child {
  animation-delay: 0.6s;
}

 

 

37. More Animations

.screen-header__icons .fa-cog๋ผ๊ณ  ์ ๋Š” ์ด์œ : ๊ทธ๋ƒฅ fa-cog๋กœ ์ ์œผ๋ฉด ์ด ์•„์ด์ฝ˜์ด ๋“ค์–ด๊ฐ„ ๋ชจ๋“  ๊ณณ์— ์ ์šฉ์ด ๋˜๊ธฐ ๋•Œ๋ฌธ์—!

.screen-header__icons .fa-cog:hover {
  animation: rotateCog 1s linear infinite;
}

 

will-change๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ข€ ๋” ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•œ๋‹ค.

→ ๋ธŒ๋ผ์šฐ์ €์—๊ฒŒ ์–ด๋–ค ๊ฒƒ์ด ๋ณ€ํ•  ๊ฒƒ์ธ์ง€ ์˜ˆ๊ณ ํ•ด์ฃผ๋Š” ๊ฒƒ! ๋ฌธ์ œ์—†์ด ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ž‘๋™๋˜๋Š” ๊ฒฝ์šฐ์— will-change๋ฅผ ๊ตณ์ด ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค.

 

 

38. Animating Chats Screen

.reply:focus-within๋Š” "reply ๋‚ด๋ถ€์— ์–ด๋–ค element๊ฐ€ focus ๋˜์–ด ์žˆ๋‹ค๋ฉด"์ด๋ผ๋Š” ๋œป

visibility: hidden์€ ์•„์˜ˆ ํด๋ฆญ์ด ์•ˆ๋˜๊ฒŒ ํ•œ๋‹ค. / opacity: 0์€ ํˆฌ๋ช…ํ•ด์ง€์ง€๋งŒ ํด๋ฆญ์ด ๋˜๊ฒŒ ํ•œ๋‹ค.

 

39. Recap

.reply:focus-within input {
width: 96vw;
transform: translateX(-13%) translateY(-80px);

.reply input:focus {
width: 96vw;
transform: translateX(-13%) translateY(-80px);

 

 

40. No Mobile Media Query

ํฐ ํ™”๋ฉด ์ ‘์† ๋ฐฉ์ง€ (media query ์‚ฌ์šฉ)

#no-mobile {
  position: absolute;
  z-index: 99;
  height: 100vh;
  width: 100vw;
  background-color: var(--yellow);
  display: flex;
  justify-content: center;
  align-items: center;
  top: 0;
  font-size: 32px;
}

@media screen and (max-width: 645px) {
  #no-mobile {
    display: none;
  }
}

๊ฐœ์ธ์ ์ธ ์‚ฌ์ •์œผ๋กœ ๊ฑฐ์˜ ํ•œ ๋‹ฌ ๋™์•ˆ ์ฝ”๋”ฉ ๊ณต๋ถ€๋ฅผ ๋ชปํ–ˆ๋‹ค. ๊ทธ๋™์•ˆ ์ตํ˜”๋˜ ๊ฐ์ด ๋งŽ์ด ์‚ฌ๋ผ์ง„ ๋А๋‚Œ์ด๋‹ค... ํ•œ ๋‹ฌ ์ „์— ๋๋‚ธ ํ”„๋กœ์ ํŠธ๋ฅผ ์ด์ œ ์™€์„œ ์ •๋ฆฌํ•˜๋‹ค ๋ณด๋‹ˆ ๊ต‰์žฅํžˆ ํ—ท๊ฐˆ๋ฆฐ๋‹ค. ์—ญ์‹œ ๊พธ์ค€ํžˆ ํ•˜๋Š” ๊ฒŒ ์ œ์ผ ์ค‘์š”ํ•˜๋‹ค๋Š” ๊ฒƒ์„ ๋‹ค์‹œ ํ•œ๋ฒˆ ๋А๊ผˆ๋‹ค..!

Comments