์ ์ฒด ๊ธ166 [React] styled-component ์ฌ์ฉํด์ html body ์ผ์ชฝ ์ฌ๋ฐฑ ์์ ๊ธฐ ๋ฌธ์ ์ํฉ ์ปดํฌ๋ํธ์ ์์น๋ฅผ left:0์ผ๋ก ์ง์ ํด์คฌ์์๋ ๋ถ๊ตฌํ๊ณ , ์ผ์ชฝ ์ฌ๋ฐฑ์ด ์์ด์ง์ง ์๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์๋ค. ์ด๊ฑด body ์ ์ฒด์ margin๊ณผ padding ๊ฐ์ 0์ผ๋ก ์ง์ ํด์ฃผ๋ฉด ๋๋๋ฐ, ํ์ฌ ํ๋ก์ ํธ์ ๊ฒฝ์ฐ styled-componet๋ฅผ ์ฌ์ฉํ๊ณ ์์๊ธฐ ๋๋ฌธ์, styled-component๋ฅผ ์ฌ์ฉํ์ฌ body ์คํ์ผ์ ์ ํด์ค ์ ์๋ ๋ฐฉ๋ฒ์ ์์๋ณด์๋ค. GlobalStyle ์ง์ ํด์ฃผ๊ธฐ GlobalStyle.js ํ์ผ์ ๋ฐ๋ก ์์ฑํด์ body ์คํ์ผ์ ์ง์ ํด์ฃผ๋ฉด ๋๋ค. import { createGlobalStyle } from "styled-components"; const GlobalStyle = createGlobalStyle` body { margin: 0; padding: 0; } .. 2022. 12. 11. [ํ๋ก๊ทธ๋๋จธ์ค JS] ๋คํญ์ ๋ํ๊ธฐ ๋๋ณด๊ธฐ ๋ฌธ์ ์ค๋ช ํ ๊ฐ ์ด์์ ํญ์ ํฉ์ผ๋ก ์ด๋ฃจ์ด์ง ์์ ๋คํญ์์ด๋ผ๊ณ ํฉ๋๋ค. ๋คํญ์์ ๊ณ์ฐํ ๋๋ ๋๋ฅํญ๋ผ๋ฆฌ ๊ณ์ฐํด ์ ๋ฆฌํฉ๋๋ค. ๋ง์ ์ผ๋ก ์ด๋ฃจ์ด์ง ๋คํญ์ polynomial์ด ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋, ๋๋ฅํญ๋ผ๋ฆฌ ๋ํ ๊ฒฐ๊ด๊ฐ์ ๋ฌธ์์ด๋ก return ํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด๋ณด์ธ์. ๊ฐ์ ์์ด๋ผ๋ฉด ๊ฐ์ฅ ์งง์ ์์์ return ํฉ๋๋ค. ์ ํ์ฌํญ 0 2022. 12. 9. [ํ๋ก๊ทธ๋๋จธ์ค JS] ์ง์ฌ๊ฐํ ๋์ด ๊ตฌํ๊ธฐ / Math.max() Math.min() ๋๋ณด๊ธฐ ๋ฌธ์ ์ค๋ช 2์ฐจ์ ์ขํ ํ๋ฉด์ ๋ณ์ด ์ถ๊ณผ ํํํ ์ง์ฌ๊ฐํ์ด ์์ต๋๋ค. ์ง์ฌ๊ฐํ ๋ค ๊ผญ์ง์ ์ ์ขํ [[x1, y1], [x2, y2], [x3, y3], [x4, y4]]๊ฐ ๋ด๊ฒจ์๋ ๋ฐฐ์ด dots๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋, ์ง์ฌ๊ฐํ์ ๋์ด๋ฅผ return ํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด๋ณด์ธ์. ์ ํ์ฌํญ dots์ ๊ธธ์ด = 4 dots์ ์์์ ๊ธธ์ด = 2 -256 { x_arr.push(dot[0]); y_arr.push(dot[1]); }) let x = Math.abs(Math.max(...x_arr) - Math.min(...x_arr)); let y = Math.abs(Math.max(...y_arr) - Math.min(...y_arr)); let answer = x*y; return a.. 2022. 12. 9. [React] React.js - Django REST framework API ์ฌ์ง ์ฌ๋ฆฌ๊ธฐ ๋ฐ ์ถ๋ ฅํ๊ธฐ Django ์ฅ๊ณ ์ค์ ์ ์ด ๊ธ์ ์ฐธ๊ณ ๋ฐ๋ https://developer0809.tistory.com/104 [#. Django] Django admin/api(drf)์ image ์ ๋ก๋ํ๊ณ react์์ image ๋ถ๋ฌ์ค๊ธฐ ์น์ฌ์ดํธ ๋๋ฉ ํ์ด์ง์ swiper.js๋ฅผ ์ด์ฉํ ์ฌ๋ผ์ด๋ ์ด๋ฏธ์ง, ์ ๋ชฉ, ๋ด์ฉ์ admin์์ ์ถ๊ฐ/์์ ํ ์ ์๋๋ก ํ๋ ค๊ณ ํ๋ค django admin์ ๋ชจ๋ธ์ ์ถ๊ฐํ๊ณ rest api์๋ ์ถ๊ฐํ ๊ฒ์ด๋ค โ Pillow ์ค์น Pillow developer0809.tistory.com React.js ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์ค์ ํด์ฃผ๋ฉด ๋๋ค. src={http://localhost:8000/letter/uploads/images/${currLetter.photoName}} 400 ์๋ฌ๋ .. 2022. 12. 8. [JS] input type=date ์ผ ๋ ์ค๋ ์ดํ๋ก๋ง ๋ ์ง ์ ํ๋๊ฒ ํ๊ธฐ // ๋ค๋ฅธ ๋ ์ง ์ ํ ์, ๋ด์ผ๋ถํฐ ์ ํ๊ฐ๋ฅํ๊ฒ ํ๊ธฐ let today = new Date(); let tomorrow = new Date(today.setDate(today.getDate() + 1)); let year = tomorrow.getFullYear(); let month = tomorrow.getMonth() + 1; let day = tomorrow.getDate(); if (month < 10) { month = "0" + month; } if (day < 10) { day = "0" + day; } let availableDay = `${year}-${month}-${day}`; ์ฐธ๊ณ ๋ฌธ์ https://developer.mozilla.org/ko/docs/Web/HTML/Elemen.. 2022. 12. 8. [Next.js] ํ๋ก์ ํธ ์์ฑํ๊ธฐ 1. ํ๋ก์ ํธ ์์ฑํ๊ธฐ - ํ์ ์คํฌ๋ฆฝํธ X npx create-next-app@latest # or yarn create next-app # or pnpm create next-app - ํ์ ์คํฌ๋ฆฝํธ O npx create-next-app@latest --typescript # or yarn create next-app --typescript # or pnpm create next-app --typescript 2. next, react, react-dom ์ค์นํ๊ธฐ npm install next react react-dom # or yarn add next react react-dom # or pnpm add next react react-dom 3. npm ์ค์นํ๊ธฐ - ์ํ๋ฉด script ์คํ ์, ".. 2022. 12. 7. [ํ๋ก๊ทธ๋๋จธ์ค JS] ์จ์ด์๋ ์ซ์์ ๋ง์ (2) ๋๋ณด๊ธฐ ๋ฌธ์ ์ค๋ช ๋ฌธ์์ด my_string์ด ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง๋๋ค. my_string์ ์๋ฌธ์, ๋๋ฌธ์, ์์ฐ์๋ก๋ง ๊ตฌ์ฑ๋์ด์์ต๋๋ค. my_string์์ ์์ฐ์๋ค์ ํฉ์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ์ ํ์ฌํญ 1 ≤ my_string์ ๊ธธ์ด ≤ 1,000 1 ≤ my_string ์์ ์์ฐ์ ≤ 1000 ์ฐ์๋ ์๋ ํ๋์ ์ซ์๋ก ๊ฐ์ฃผํฉ๋๋ค. 000123๊ณผ ๊ฐ์ด 0์ด ์ ํํ๋ ๊ฒฝ์ฐ๋ ์์ต๋๋ค. ๋ฌธ์์ด์ ์์ฐ์๊ฐ ์๋ ๊ฒฝ์ฐ 0์ return ํด์ฃผ์ธ์. ์ ์ถ๋ ฅ ์my_stringresult "aAb1B2cC34oOp" 37 "1a2b3c4d123Z" 133 ์ ์ถ๋ ฅ ์ ์ค๋ช ์ ์ถ๋ ฅ ์ #1 "aAb1B2cC34oOp"์์ ์์ฐ์๋ 1, 2, 34 ์ ๋๋ค. ๋ฐ๋ผ์ 1 + 2 + 34 .. 2022. 12. 7. [ํ๋ก๊ทธ๋๋จธ์ค JS] ์ด์ง์ ๋ํ๊ธฐ (10์ง์ 2์ง์ ๋ณํ) ๋๋ณด๊ธฐ ๋ฌธ์ ์ค๋ช ์ด์ง์๋ฅผ ์๋ฏธํ๋ ๋ ๊ฐ์ ๋ฌธ์์ด bin1๊ณผ bin2๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋, ๋ ์ด์ง์์ ํฉ์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ์ ํ์ฌํญ return ๊ฐ์ ์ด์ง์๋ฅผ ์๋ฏธํ๋ ๋ฌธ์์ด์ ๋๋ค. 1 ≤ bin1, bin2์ ๊ธธ์ด ≤ 10 bin1๊ณผ bin2๋ 0๊ณผ 1๋ก๋ง ์ด๋ฃจ์ด์ ธ ์์ต๋๋ค. bin1๊ณผ bin2๋ "0"์ ์ ์ธํ๊ณ 0์ผ๋ก ์์ํ์ง ์์ต๋๋ค. ์ ์ถ๋ ฅ ์bin1bin2result "10" "11" "101" "1001" "1111" "11000" ์ ์ถ๋ ฅ ์ ์ค๋ช ์ ์ถ๋ ฅ ์ #1 10 + 11 = 101 ์ด๋ฏ๋ก "101" ์ returnํฉ๋๋ค. ์ ์ถ๋ ฅ ์ #2 1001 + 1111 = 11000 ์ด๋ฏ๋ก "11000"์ returnํฉ๋๋ค. ์๊ณ ๋ฆฌ์ฆ ๊ตฌํ์ ์ํด์ .. 2022. 12. 7. [๊ฐ๋ฐ์ผ์ง] ํ์ด๋๋ผ์ค ํ ๊ถ ์์ค ๋ฐฑ๊ณผ์ฌ์ ์์ด๋์ด ๋๋ (ํ์ ์ ์ธ) ํฅ์ ๋ฃ๊ฐ ๋ค์ด๊ฐ ์์๋ค์ ๊ทธ๋ค์ง ์ข์ํ์ง ์์ ํ ๊ถ๋ฅผ ๋จน์ด๋ณธ ์ ์ด ์์๋ค. ํ์ง๋ง ์์ ๋ด ์ฃผ๋ณ ์น๊ตฌ๋ค์ 'ํ์ด๋๋ผ์ค'๋ผ๋ ์๋น์ ๋งค์ฐ ์ข์ํ๋ ๋ฐ, ์ด ๊ณณ์ ๋ค๋ฅธ ํ ๊ถ ์๋น๊ณผ๋ ๋ค๋ฅด๊ฒ ์ง์ ์์ค๋ฅผ ๋ง๋ค์ด๋จน์ ์ ์๋ ์์ค๋ฐ๊ฐ ์๋ค. ์์ค ์ฌ๋ฃ ์ข ๋ฅ๊ฐ ์ ๋ง ๋ค์ํ๊ธฐ ๋๋ฌธ์ ์ด๋ค์ ์กฐํฉํ ์ ์๋ ๋ ์ํผ ๋ํ ์์ฃผ ๋ง๋ค. ํ์ง๋ง ์๋น์๋ 4~5๊ฐ์ง์ ์์ค ์ ์กฐ๋ฒ๋ง ์ ํ์์๋ค. ์ธํฐ๋ท์์ ๋ด๊ฐ ๋ณธ ์์ค ๋ ์ํผ๋ ๋ ๋ง์๋๋ฐ! ๊ทธ๋์ ์ด ๋ ์ํผ๋ค์ ๋ชจ์์ ํ ๊ณณ์์ ํ์ธํ ์ ์๋ค๋ฉด ์ ๋ง ํธํ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์๋ค. ๋ฒ์ 1 ๊ฐ๋ฐ ์ด ๋ ๋น์์๋ ๋ด๊ฐ ๋ง HTML/CSS ๊ทธ๋ฆฌ๊ณ ์๋ฐ์คํฌ๋ฆฝํธ ์กฐ๊ธ ์ ์ํด๊ฐ๋ ๋์๊ธฐ ๋๋ฌธ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค๊ฐ์ ๊ณ ์ค๊ธ ๊ธฐ์ ์ ์๊ฐํ ์ฌ๋ ฅ์ด ์์๋ค. ๋ ์.. 2022. 12. 7. ์ด์ 1 ยทยทยท 6 7 8 9 10 11 12 ยทยทยท 19 ๋ค์