code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,33 @@
+import letters from "../mockData";
+
+const sleep = n => new Promise(resolve => setTimeout(resolve, n));
+
+export const getLetters = async () => {
+ await sleep(500);
+ return letters;
+};
+
+export const getLetterById = async id => {
+ await sleep(100);
+ return letters.find(letter => letter.id ... | JavaScript | ๋ฐฐ์ด์์ ์ํ๋ ์กฐ๊ฑด๊น์ง๋ง ์ฐพ๋ find method๋ฅผ ์ฌ์ฉํ ๊ฑด ์ข์๋ณด์
๋๋ค ! |
@@ -0,0 +1,24 @@
+import React from "react";
+import styled from "styled-components";
+
+const Footer = () => {
+ return (
+ <FooterBlock>
+ <p className="copyright">© Museop Kim</p>
+ </FooterBlock>
+ );
+};
+
+const FooterBlock = styled.div`
+ display: flex;
+ justify-content: center;
+ align-ite... | Unknown | style components๋ฅผ ์ฌ์ฉํ์๋๊น
`box-shadow: 0px -10px 35px 5px #f1f1f1;`
๋ถ๋ถ์ ์์ ๊ฐ์ ๊ฒฝ์ฐ๋ styled-components ThemeProvider๋ฅผ ์ฌ์ฉํด ๋ณด๋๊ฑด ์ด๋จ๊น์.
๋ชจ๋ ์ปดํฌ๋ํธ๊ฐ ์ ๋ฌ๋ฐ์ ์์์ ๋์ผํ๊ฒ ์ฌ์ฉํ๋ฉด ๋คํฌ๋ชจ๋์ ๊ฐ์ ๊ธฐ๋ฅ์ ๊ตฌํํ ๋๋ ์์ฝ๊ฒ ์คํ์ผ ๋ณ๋์ด ๊ฐ๋ฅํฉ๋๋ค.
๋๋ฌด ๋ง์ด ์งํ๋ ํ๋ก์ ํธ๋ ์คํ์ผ ์์คํ
์ ๊ตฌ์ถํ๊ธฐ ์ฝ์ง ์์ผ๋๊น ์ข ์์ ๋จ์์ผ ๋ ์๋ํด ๋ณด๋๊ฒ๋ ์ข์๊ฑฐ ๊ฐ์์ ๐ |
@@ -0,0 +1,47 @@
+import React from "react";
+import styled from "styled-components";
+import { Link } from "react-router-dom";
+
+const Navigation = () => {
+ return (
+ <NavigationBlock>
+ <Link to="/">์ ์ฒญ๊ณก</Link>
+ <Link to="/ranking">์ ์ฒญ๊ณก ์์</Link>
+ <Link to="/contents">์ ์ฒญ๊ณก ์ ํ๋ธ ์์</Link>
+ <L... | Unknown | ํฐํธ์ ๊ฐ์ด ๋ฐ์ํ์ ์ํฅ์ ๋ฐ์์ผ ํ๋ ๊ธฐ์ค๊ณผ ๊ทธ๋ ์ง ์์ ์์๋ฅผ ๊ธฐ์ค์ผ๋ก px๊ณผ rem์ ์ฌ์ฉํ์๋ ๊ฑด๊ฐ์ ?
๊ทธ๋ฐ ์๋๋ผ๋ฉด ์ข์๋ณด์
๋๋ค. |
@@ -0,0 +1,147 @@
+import React from "react";
+import styled from "styled-components";
+
+const MAX_LENGTH = 100;
+
+const Letter = ({
+ id,
+ user,
+ song,
+ songStory,
+ createdDateTime,
+ onReadLetter
+}) => {
+ const { username, avatarUrl } = user;
+ const { title, artist, imageUrl } = song;
+
+ return (
+... | Unknown | className ์ปจ๋ฒค์
์ค "-"์ "_"๋ ์ด๋ค ๊ธฐ์ค์ด ์์๊น์ ? ๊ถ๊ธํฉ๋๋ค ใ
|
@@ -0,0 +1,29 @@
+import React from "react";
+import styled from "styled-components";
+import LetterContainer from "../../containers/Letter/LetterContainer";
+
+const LetterList = ({ letters }) => {
+ return (
+ <LetterListBlock>
+ {letters.map(letter => (
+ <LetterContainer
+ key={letter.id}
+... | Unknown | ๋ณดํต Container๋ ์ข ๋ ํฐ ๋จ์์์์ ์๋ฏธ์์ ์ฌ์ฉ๋๊ณค ํ๋๊ฑฐ ๊ฐ์์.
์ฌ๋ฌ ์์ ์ปดํฌ๋ํธ๋ฅผ ๊ฐ์ง๊ณ ๋ง์ ์ด๋ฒคํธ ๋ก์ง์ ๊ฐ์ง๊ณ ์๋ ์ผํฐ์ ๋๋์ผ๋ก ๋ค์ด๋ฐ์ ํ๊ณค ํ๋๋ฐ
LetterList๋ฉด LetterItem๊ณผ ๊ฐ์ด ๋จ์ผํ๊ฒ ํํํด ์ฃผ๋๊ฒ๋ ์ข์๊ฑฐ ๊ฐ์์ ! |
@@ -0,0 +1,30 @@
+import React, { useEffect, useState } from "react";
+import ModalTemplate from "../Template/Modal/ModalTemplate";
+import LetterDetailsSong from "./LetterDetailsSong";
+import LetterDetailsSongStory from "./LetterDetailsSongStory";
+import LetterModalTemplate from "../Template/LetterModal/LetterModalT... | Unknown | `const { song, songStory, createdDateTime, user } = letter;`
๋๋ฌด ๋ง์ ์์ ๊ฐ์ฒด Props๊ฐ ์๋๋ผ๋ฉด ์ด ๋ถ๋ถ ๊ฐ์ ๊ฒฝ์ฐ๋ ๊ฐ๊ฐ ์ด๋ฆ์ ๊ฐ์ง Props๋ก ์ ๋ฌํด ์ฃผ๋๊ฒ๋ ์ข์๊ฑฐ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ญ๋๋ค! ๊ทธ๋ฌ๋ฉด ๊ฐ๋จํ๊ฒ ์ปดํฌ๋ํธ์ ์ง์ ๋ค์ด์ ๋ณด์ง ์์๋ ์ ๋ฌ๋๋ Props ๋ง์ผ๋ก ์ญํ ์ ์ ์ถํด ๋ณผ ์ ์์๊ฑฐ ๊ฐ์์. |
@@ -0,0 +1,45 @@
+import React, { useEffect } from "react";
+import { MdMoreHoriz } from "react-icons/md";
+import styled, { css } from "styled-components";
+import LetterDetailsHiddenMenuButton from "./LetterDetailsHiddenMenuButton";
+
+const LetterDetailsHiddenMenu = ({
+ isMouseEnter,
+ isMenuOpen,
+ onToggle,
+ ... | Unknown | visibility: hidden; , display : none ์ ์ฐจ์ด๋ฅผ ์์๋์ ? ใ
ใ
๋ชจ๋ฅด๊ณ ๊ณ์ ๋ค๋ฉด ํ๋ฒ ์์๋ณด๋๊ฒ๋ ์ข์ต๋๋ค ! ๋๋จํ๊ฑด ์๋๊ณ ๊ทธ๋ฅ DOM ํธ๋ฆฌ์ ๊ด๋ จ๋ ๋ด์ฉ์ด์์. |
@@ -0,0 +1,28 @@
+import React from "react";
+import LetterModalSong from "../LetterModal/LetterModalSong/LetterModalSong";
+import SongAbout from "../LetterModal/LetterModalSong/SongAbout";
+import SongArticle from "../LetterModal/LetterModalSong/SongArticle";
+import SongArticleItem from "../LetterModal/LetterModalSo... | Unknown | ์ด ๋ถ๋ถ์ ๊ฒฝ์ฐ ๋ฐ๋ณต๋๋ ์ปดํฌ๋ํธ๋ก ๋ณด์ด๋๋ฐ ์ด๊ฑธ ํ๋๋ก ๋ฌถ์ด์ ๊ด๋ฆฌํด ๋ณด๋๊ฑด ์ด๋จ๊น์ ?
<SongArticle>
<SongArticleName articleName={"TITLE"} />
<SongArticleItem articleName={"TITLE"} item={title} />
</SongArticle> |
@@ -0,0 +1,48 @@
+import React from "react";
+import styled from "styled-components";
+import { BiSearch } from "react-icons/bi";
+import useModal from "../../hooks/useModal";
+import SongSearchModal from "./SongSearchModal/SongSearchModal";
+
+const LetterEditorSearchButton = () => {
+ const [isOpened, onOpenModal, o... | Unknown | modal๊ณผ ๊ด๋ จ๋ ๋์์ custom hook์ผ๋ก ์ฌ์ฉํ ๋ถ๋ถ ์ข์ ๋ณด์
๋๋ค ! |
@@ -0,0 +1,108 @@
+import React from "react";
+import styled from "styled-components";
+import { BiSearch } from "react-icons/bi";
+import { useDispatch } from "react-redux";
+import { searchSong } from "../../../modules/song";
+
+const SearchForm = ({ onCloseModal }) => {
+ const dispatch = useDispatch();
+
+ const ... | Unknown | Form์ด ์ ์ ๋ ๋ณต์กํ ์ํ๋ฅผ ๊ฐ์ง๋ฉด ๊ด๋ฆฌ๊ฐ ์ฝ์ง ์์๋ฐ ๊ทธ๋ด๋
https://react-hook-form.com/
์์ ๊ฐ์ ๋๊ตฌ๋ฅผ ๋์
ํด ๋ณผ ์๋ ์์ต๋๋ค ใ
|
@@ -0,0 +1,24 @@
+import React from "react";
+import styled from "styled-components";
+
+const Footer = () => {
+ return (
+ <FooterBlock>
+ <p className="copyright">© Museop Kim</p>
+ </FooterBlock>
+ );
+};
+
+const FooterBlock = styled.div`
+ display: flex;
+ justify-content: center;
+ align-ite... | Unknown | ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฌ์ฉ ํ๋ฏ์ด ์คํ์ผ๋ ์ฌ๋ฌ ๊ณณ์ ์ฌ์ฌ์ฉ ํ๋ ๋ฐฉ๋ฒ์ด ์์๋ค์. `ThemeProvider`์ ๋ํด ์ ๋ชฐ๋๋๋ฐ ์ด๋ฒ ๊ธฐํ์ ํ๋ฒ ํ์ต ํด๋ณด๊ณ ํด๋ณผ ์ ์๋ค๋ฉด ์ ์ฉ๊น์ง ํด๋ณด๊ฒ ์ต๋๋ค! ์กฐ์ธ ํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค ๐ |
@@ -0,0 +1,47 @@
+import React from "react";
+import styled from "styled-components";
+import { Link } from "react-router-dom";
+
+const Navigation = () => {
+ return (
+ <NavigationBlock>
+ <Link to="/">์ ์ฒญ๊ณก</Link>
+ <Link to="/ranking">์ ์ฒญ๊ณก ์์</Link>
+ <Link to="/contents">์ ์ฒญ๊ณก ์ ํ๋ธ ์์</Link>
+ <L... | Unknown | ์ฒ์์๋ ๋ง์ ํ์ ๊ฒ์ฒ๋ผ px๊ณผ rem์ ๊ตฌ๋ถํด์ ์ฌ์ฉ ํ๋ค๊ฐ ์๋ ๊ฐ์ธ rem์ผ๋ก ๋จ์๋ฅผ ํต์ผํ๊ณ ์ ์ฉ ํ์ต๋๋ค. ํน์ ์ด๋ ๊ฒ ํ ๊ฒฝ์ฐ ์ฃผ์ํด์ผ ๋ ๊ณ ๋ ค์ฌํญ ๊ฐ์๊ฒ ์์๊น์? |
@@ -0,0 +1,147 @@
+import React from "react";
+import styled from "styled-components";
+
+const MAX_LENGTH = 100;
+
+const Letter = ({
+ id,
+ user,
+ song,
+ songStory,
+ createdDateTime,
+ onReadLetter
+}) => {
+ const { username, avatarUrl } = user;
+ const { title, artist, imageUrl } = song;
+
+ return (
+... | Unknown | ์ปดํฌ๋ํธ ์ด์ธ์ className์ ์ง์ ์ฌ์ฉํ ๋๋ ๋๋ถ๋ถ CSS ๋ค์ด๋ฐ ์ปจ๋ฒค์
์ผ๋ก ์๋ ค์ง `BEM` ์ ์ ์ฉ ํ์ต๋๋คใ
ใ
`-`๋ ๋ ๋จ์ด๋ฅผ ์ฐ๊ฒฐํด์ผ ํ ๋, `__`๋ ํน์ ๋ธ๋ญ์ ๊ตฌ์ฑํ๋ ํ์ ์์๋ฅผ ๊ตฌ๋ถํ ๋ ์ฌ์ฉ ํ๋ ๋ฏ ํ๋ค์.
[CSS BEM](https://css-tricks.com/bem-101/) ์ ์ฐธ๊ณ ํ์ต๋๋ค :) |
@@ -0,0 +1,29 @@
+import React from "react";
+import styled from "styled-components";
+import LetterContainer from "../../containers/Letter/LetterContainer";
+
+const LetterList = ({ letters }) => {
+ return (
+ <LetterListBlock>
+ {letters.map(letter => (
+ <LetterContainer
+ key={letter.id}
+... | Unknown | Container๋ฅผ ์ธ์ ์ฌ์ฉํด์ผ ํ ์ง ๋ช
ํํ ๊ธฐ์ค์ด ์์๋๋ฐ, ๋ฆฌ๋ทฐ ํด์ฃผ์ ๋ด์ฉ์ ๋ณด๊ณ ๊ณ ๋ฏผ ๋๋ ๊ฒ๋ค์ด ๋ง์ด ๋์ด์ง๋ ๋๋์ด์์.
๋ค์ ์์ ๋ ๋ฐ์ ํ๊ฒ ์ต๋๋ค ๐ |
@@ -0,0 +1,30 @@
+import React, { useEffect, useState } from "react";
+import ModalTemplate from "../Template/Modal/ModalTemplate";
+import LetterDetailsSong from "./LetterDetailsSong";
+import LetterDetailsSongStory from "./LetterDetailsSongStory";
+import LetterModalTemplate from "../Template/LetterModal/LetterModalT... | Unknown | ๊ฐ๋ฅํ๋ค๋ฉด ๊ฐ์ฒด ์์ฒด๋ฅผ ๋๊ธฐ๋ ๊ฒ์ด ์ฌ๋ฌ ์ธก๋ฉด์์ ๋ ์ข์๊ฑฐ ๊ฐ๋ค๋ ์๊ฐ์ด์๋๋ฐ, ์๋ ๊ฒฝ์ฐ๋ ์๊ฒ ๋ค๋ ์๊ฐ์ด ๋๋ค์!
์์ ํ ๋ ๋ฐ์ ํ๊ฒ ์ต๋๋ค ๐ |
@@ -0,0 +1,45 @@
+import React, { useEffect } from "react";
+import { MdMoreHoriz } from "react-icons/md";
+import styled, { css } from "styled-components";
+import LetterDetailsHiddenMenuButton from "./LetterDetailsHiddenMenuButton";
+
+const LetterDetailsHiddenMenu = ({
+ isMouseEnter,
+ isMenuOpen,
+ onToggle,
+ ... | Unknown | `display: none`์ DOM์ ์ํฅ์ ๋ฏธ์น์ง ์๋ ๋ฐ๋ฉด `visibility: hidden` ์ DOM์ ์ํฅ์ ์ฃผ๋ ๊ฒ์ผ๋ก ์๊ณ ์์์ด์ใ
ใ
`transition` ์ `display: none`์์ ์๋ํ์ง ์์์ `visibility` ์์ฑ์ ์ฌ์ฉํ๊ฒ ๋๋๋ฐ, ํน์ ์ปจ๋ฒค์
์ด ๋ฐ๋ก ์๋ค๊ฑฐ๋ ๋ ํจ์จ์ ์ธ ๋ฐฉ๋ฒ์ด ์์๊น์? |
@@ -0,0 +1,28 @@
+import React from "react";
+import LetterModalSong from "../LetterModal/LetterModalSong/LetterModalSong";
+import SongAbout from "../LetterModal/LetterModalSong/SongAbout";
+import SongArticle from "../LetterModal/LetterModalSong/SongArticle";
+import SongArticleItem from "../LetterModal/LetterModalSo... | Unknown | ์ปดํฌ๋ํธ๋ฅผ ์์ ํ ๋ค ๋ถ๋ฆฌ ํ ๋ค์ ํ๋ฒ ๋ ์ ๋ฆฌ๋ฅผ ํ์ด์ผ ํ๋๋ฐ ์ด๋ฐ ์ค๋ณต์ ๋ฌถ์ด์ ์ค์ด๋๊ฒ ์ข์๊ฑฐ ๊ฐ์์. ๋ฐ์ ํด๋ณด๊ฒ ์ต๋๋ค. ์๋ ค์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,108 @@
+import React from "react";
+import styled from "styled-components";
+import { BiSearch } from "react-icons/bi";
+import { useDispatch } from "react-redux";
+import { searchSong } from "../../../modules/song";
+
+const SearchForm = ({ onCloseModal }) => {
+ const dispatch = useDispatch();
+
+ const ... | Unknown | ์ง๊ธ ์ ๋์ ํผ ์ฌ์ฉ์์๋ ์ง์ ๊ตฌํ๋ ๋ฌด๋ฆฌ๊ฐ ์์์ง๋ง, ํผ์ด ๋ณต์กํด์ง๋ฉด ํ์คํ ๊ด๋ฆฌํ๊ธฐ๋ ์ฝ์ง ์์ ๋ฏ ํ๋๋ผ๊ตฌ์.
๊ธฐ์ต ํด๋์๋ค๊ฐ ํ์ํ ๋ ์ ์ฉ ํด๋ณด๊ฒ ์ต๋๋ค :) ์๋ ค์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค. |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ ๋ ์ด๋ฒคํธ์ ์ด๋ฆ์ด ์๋ฏธํ๋๊ฒ "ํ์์ ๋ฐ์" ์ด๋ผ๊ณ ์๊ฐํด์.
๊ฐ๋ น, `onChange` ๋ ์ค์ ๋ก change๊ฐ ์ผ์ด๋ฌ์ ๋์ด๊ณ , `onKeyDown` ์ ํค๋ฅผ ๋๋ ์ ๋ ์
๋๋ค.
`onSearch`๋ "๊ฒ์์ด ๋์์ ๋ ๋ฐ์" ์ธ๋ฐ, ์ด ์ปดํฌ๋ํธ์์ ์ค์ ๋ก "๊ฒ์"์ด๋ผ๋ ํ์๊ฐ ์ผ์ด๋ฌ๋ค๊ณ ํ ์ ์์๊น์?
์ง๊ธ์ "๊ฒ์"์ด๋ผ๋ ํ์๋ฅผ ๋ฐ์์ ์ฃผ์
ํด์ฃผ๊ณ , ์ด ์ปดํฌ๋ํธ ๋ด๋ถ์์ ์ผ์ด๋ ์ผ์ "์ํฐํค๋ฅผ ๋๋ ์" ์
๋๋ค.
์ฆ, ์ด๋ฒคํธ๋ "๊ฒ์ํ์ ๋ ๋ฐ์ํจ"์ ์ด์ผ๊ธฐํ๊ณ ์๋๋ฐ ๊ฒ์์ด๋ผ๋ ๊ธฐ๋ฅ์ ๋ฐ์์ ์ฃผ์
ํด์ค ์ ๋ฐ์ ์๋ ์ํฉ์ธ๊ฑฐ์ฃ . |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ด ๋ถ๋ถ๋ ๋์ผํฉ๋๋ค! |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ฌ๊ธฐ์ ์ฐ์ด๋ 390 ์ด๋ผ๋ ์ซ์๋ ์์๋ก ๋ง๋ค์ด์ ์ฌ์ฉํด์ฃผ๋ฉด ์ด๋จ๊น์!? |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ ๋ณด๋๊น ๋ก์ง์ด ๊ฑฐ์ ์ ์ฌํ๋ค์! |
@@ -0,0 +1,33 @@
+import handleMovie from '../services/handleMovie';
+import Button from './Button';
+
+function MainContent(initialPage) {
+ let page = initialPage;
+ const mainElement = document.createElement('main');
+ mainElement.id = 'main';
+
+ mainElement.innerHTML = `
+ <section class="item-v... | JavaScript | ```suggestion
const mainElement = html(`
<main id="main">
<section class="item-view">
<h2>์ง๊ธ ์ธ๊ธฐ ์๋ ์ํ</h2>
<ul class="item-list"></ul>
</section>
<main>
`);
```
์ด๋ ๊ฒ ํํํ ์ ์๋๋ก ํจ์๋ฅผ ํ๋ ๋ง๋ค์ด์ฃผ์๋ฉด ์ด๋จ๊น์!? |
@@ -0,0 +1,33 @@
+import handleMovie from '../services/handleMovie';
+import Button from './Button';
+
+function MainContent(initialPage) {
+ let page = initialPage;
+ const mainElement = document.createElement('main');
+ mainElement.id = 'main';
+
+ mainElement.innerHTML = `
+ <section class="item-v... | JavaScript | ์์์๋ html template์ผ๋ก ํํ๋๊ณ ์ฌ๊ธฐ์๋ ์ด๋ ๊ฒ ํํ๋๊ณ ์์ด์ ์ฝ๋๋ฅผ ์ฝ๋ ์ฌ๋ ์
์ฅ์์๋ ์กฐ๊ธ ํท๊ฐ๋ฆฌ์ง ์์๊น ์ถ์ด์! |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | ์ํ.. ์ด ํ์ผ ๋๋ฌธ์ tsconfig๊ฐ ์๊ธด๊ฑฐ์๊ตฐ์ |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | try ๊ตฌ๊ฐ์์ ์ค๋ฅ ๋ฐ์ -> catch๋ก ์ง์
-> ๋ฌด์กฐ๊ฑด status๋ 400์ผ๋ก ๊ณ ์ ํ์ฌ ๋ค์ error throw
์ด๋ ๊ฒ ๋ฉ๋๋ค.
์ ์๋ฏธํ ์๋ฌ ํ๋ก์ฐ์ผ๊น์~? |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | ๊ทธ๋ฐ๋ฐ ์ด ํ์ผ์ด ์ domain ์ ํด๋นํ๋๊ฑธ๊น์~?
domain์ด๋ผ๊ณ ํ๊ธฐ์ ๋ง ๊ทธ๋๋ก ์ฌ์ด๋ ์ดํํธ(client)๋ฅผ ํํํ๊ฑฐ๋ผ์... ์ ํ ์ฐ๊ด์ด ์์ด๋ณด์ฌ์! |
@@ -0,0 +1,24 @@
+import getMovieList from '../apis/getMovieList';
+import ConfirmModal from '../components/modal/ConfirmModal';
+import { Modal } from '../components/modal/container/Modal';
+import { NOT_MORE_MOVIES_MESSAGE } from '../constants/message';
+import renderMovies from '../view/renderMovies';
+import render... | JavaScript | api์์ ๋ฐ์ํ ์๋ฌ ์ค์ message๋ง ์ฌ์ฉํ๊ณ ์๋๋ฐ, CustomError๋ฅผ ๋ง๋ค์ด์ ์ฐ๋ ์๋ฏธ๊ฐ ์๋๊ฑด๊ฐ ์ถ์ด์! |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | domain์ด apis๋ฅผ ์ฐธ์กฐํ๋๊ฑด ์ด์ํด๋ณด์ฌ์! |
@@ -1,2 +1 @@
export const BASE_URL = 'https://api.themoviedb.org';
-export const IMAGE_BASE_URL = 'https://image.tmdb.org/t/p/w500'; | JavaScript | ์ด๋ฐ ์ ๋ณด๋ ์์ API๋ฅผ ์์ฒญํ๋ ์ชฝ์์ ๊ฐ์ง๊ณ ์์ผ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1 @@
+export const NOT_MORE_MOVIES_MESSAGE = '๋์ด์ ์ํ๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค.'; | JavaScript | ์ด๋ฐ ์๋ฌ ๋ฉ์ธ์ง๋ ๋ฉ์ธ์ง๋ฅผ ์ฌ์ฉํ๋ ์ชฝ์์ ๊ฐ์ง๊ณ ์์ผ๋ฉด ์ด๋จ๊น์?
๋ค๋ฅธ ๊ตฌ๊ฐ์์๋ ์์ ์ฌ์ฉ๋ ๊ฒ ๊ฐ์ง ์์์์! |
@@ -0,0 +1,75 @@
+package bridge.controller;
+
+import bridge.BridgeRandomNumberGenerator;
+import bridge.constants.GameValue;
+import bridge.domain.Bridge;
+import bridge.domain.BridgeGame;
+import bridge.domain.BridgeMaker;
+import bridge.view.handler.InputHandler;
+import bridge.view.OutputView;
+
+public class Brid... | Java | ๋ค๋ฆฌ๋ฅผ ๋๋ฉด์ ์ด๋์ ๋ฐ๊ณ ์๋ ํํ๋ผ์,
์ด๋์ด ์คํจํด๋ ๋ฐ๋ก ์ฌ์๋ ์ฌ๋ถ๋ฅผ ๋ฌป์ง ์๊ณ , ๊ทธ๋ฅ ์งํ์ด ๋๋ ๊ฒ ๊ฐ์ต๋๋ค..! |
@@ -0,0 +1,75 @@
+package bridge.controller;
+
+import bridge.BridgeRandomNumberGenerator;
+import bridge.constants.GameValue;
+import bridge.domain.Bridge;
+import bridge.domain.BridgeGame;
+import bridge.domain.BridgeMaker;
+import bridge.view.handler.InputHandler;
+import bridge.view.OutputView;
+
+public class Brid... | Java | ์คํจํ๊ณ ์ฌ์๋๋ ์ข
๋ฃ๋ฅผ ์
๋ ฅํ์ ๋, ๊ฒ์์ด ์ข
๋ฃ๋์ง ์๊ณ ๊ณ์ ๋ค์ ์ด๋ ์
๋ ฅ์ ๋ฐ๋ ๊ฒ ๊ฐ์ต๋๋ค..!
์คํจํ๊ณ ์ฌ๊ธฐ๋ก ๋ค์ด์์ status๋ฅผ false๋ก ๋ฐ๊ฟ์ฃผ๋ ๋ถ๋ถ์ด ์์ด์์ธ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,75 @@
+package bridge.controller;
+
+import bridge.BridgeRandomNumberGenerator;
+import bridge.constants.GameValue;
+import bridge.domain.Bridge;
+import bridge.domain.BridgeGame;
+import bridge.domain.BridgeMaker;
+import bridge.view.handler.InputHandler;
+import bridge.view.OutputView;
+
+public class Brid... | Java | ์ด๋ํ์ ๋ X๊ฐ ๋์ค๋ฉด ์ฌ์์์ด ๋์์ผํ๋๋ฐ
์ด๊ฑฐ ์ ๊ฐ ๋ฌธ์ ๋ฅผ ์ ๋ชป์ดํดํ๋ค์ ใ
ใ
.. |
@@ -0,0 +1,75 @@
+package bridge.controller;
+
+import bridge.BridgeRandomNumberGenerator;
+import bridge.constants.GameValue;
+import bridge.domain.Bridge;
+import bridge.domain.BridgeGame;
+import bridge.domain.BridgeMaker;
+import bridge.view.handler.InputHandler;
+import bridge.view.OutputView;
+
+public class Brid... | Java | ๊ทธ๋ฌ๋ค์ ๋ถ๋ฆฌํ๊ธฐ์ ์๋ ์ ์๋์ํด์ ๋ฆฌํฉํ ๋ง๋จ๊ณ์์ ์ค์ํ๋๋ด
๋๋ค..
๋ง์ง๋ง์ ๋ค์ ํ๋ฒ ๊ผผ๊ผผํ ์ฒดํฌํด์ผ๊ฒ ๋ค์ ๐จ |
@@ -0,0 +1,14 @@
+package bridge.constants;
+
+public class GameValue {
+
+ private GameValue() {
+ }
+
+ public static final String MOVE_UP_COMMAND = "U";
+ public static final String MOVE_DOWN_COMMAND = "D";
+ public static final String RETRY_COMMAND = "R";
+ public static final String QUIT_COMMAND ... | Java | ๊ด๋ จ ์๋ ์์๋ผ๋ฆฌ Enum ์ผ๋ก ๋ฌถ์ด๋ด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,17 @@
+package bridge.constants;
+
+import java.util.regex.Pattern;
+
+public enum RegexPattern {
+ ONLY_NUMBER(Pattern.compile("\\d+"));
+
+ private final Pattern pattern;
+
+ RegexPattern(Pattern pattern) {
+ this.pattern = pattern;
+ }
+
+ public boolean matches(String value) {
+ ... | Java | Pattern ์์ฒด๋ฅผ Enum ์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ์ ์๊ฐํด๋ณด์ง ๋ชปํ๋๋ฐ, ์ด๊ฑฐ ๊ฝค๋ ์ฌํ์ฉ์ฑ์ด ๋๊ฒ ๊ตฐ์ ๐ |
@@ -0,0 +1,75 @@
+package bridge.controller;
+
+import bridge.BridgeRandomNumberGenerator;
+import bridge.constants.GameValue;
+import bridge.domain.Bridge;
+import bridge.domain.BridgeGame;
+import bridge.domain.BridgeMaker;
+import bridge.view.handler.InputHandler;
+import bridge.view.OutputView;
+
+public class Brid... | Java | ์ด ๋ถ๋ถ์ ์ธ๋ดํธ๋ฅผ 1๋ก ๋ฆฌํฉํ ๋งํ๋ ๊ณ ํต์ค๋ฌ์ด(?) ๊ฒฝํ์ ํด๋ณด์
๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
์ ๋ ์ ๋ ๋ชป ์ค์ผ ๊ฒ ๊ฐ๋ ์ธ๋ดํธ๋ฅผ ์ค์ด๋ ค๊ณ ์ด๋ฆฌ์ ๋ฆฌ ๋นํ๋ค๋ณด๋(?) ๋ค์ํ ์ธ์ฌ์ดํธ๋ค์ด ๋ ์ค๋ฅด๋๋ผ๊ณ ์..! |
@@ -0,0 +1,82 @@
+package bridge.domain;
+
+import bridge.constants.GameValue;
+
+/**
+ * ๋ค๋ฆฌ ๊ฑด๋๊ธฐ ๊ฒ์์ ๊ด๋ฆฌํ๋ ํด๋์ค
+ */
+public class BridgeGame {
+
+ private int retryCount;
+ private MoveResult moveResult;
+
+ public BridgeGame(MoveResult moveResult, int retryCount) {
+ this.moveResult = moveResult;
+ ... | Java | ์ฌ๊ธฐ early return ์ด ๋น ์ง ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,37 @@
+package bridge.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoveResult {
+ private final List<String> upperBridge;
+ private final List<String> lowerBridge;
+
+ public MoveResult() {
+ this.upperBridge = new ArrayList<>();
+ this.lowerBridge = n... | Java | > ํต์ฌ ๋ก์ง์ ๊ตฌํํ๋ ์ฝ๋์ UI๋ฅผ ๋ด๋นํ๋ ๋ก์ง์ ๋ถ๋ฆฌํด ๊ตฌํํ๋ค.
์ด ๋ถ๋ถ์ ์๊ตฌ์ฌํญ์ด ์ง์ผ์ง์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค.
ํ๋ฆฌ์ฝ์ค ๊ธฐ๊ฐ ๋์ ๊ฐ์ฅ ๋ง์ด ์๊ตฌ๋ ํ๋ก๊ทธ๋๋ฐ ๊ธฐ๋ฒ์ด๋ผ, ์ด ๋ถ๋ถ์ ๊ผญ ๋ฆฌํฉํ ๋ง ํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,56 @@
+package bridge.view;
+
+import bridge.domain.BridgeGame;
+import bridge.domain.MoveResult;
+
+/**
+ * ์ฌ์ฉ์์๊ฒ ๊ฒ์ ์งํ ์ํฉ๊ณผ ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅํ๋ ์ญํ ์ ํ๋ค.
+ */
+public class OutputView {
+
+ public void printStartMessage() {
+ println("๋ค๋ฆฌ ๊ฑด๋๊ธฐ ๊ฒ์์ ์์ํฉ๋๋ค.");
+ }
+
+ public void printBridgeSizeInputMessage()... | Java | ํ์คํ ์ถ๋ ฅ์ฉ ๋ฉ์์ง๊ฐ ์ฌํ์ฉ๋๋ ๊ฒฝ์ฐ๊ฐ ์๋ค๋ณด๋, ์ด๋ ๊ฒ ํ๋ ์ฝ๋ฉํด๋ ๊ฝค๋ ์ง๊ด์ ์ด์์? ๋ผ๋ ๋๋์ ๋ฐ์์ต๋๋ค ๐ |
@@ -0,0 +1,42 @@
+package bridge.view.handler;
+
+import bridge.domain.Bridge;
+import bridge.domain.BridgeMaker;
+import bridge.view.ErrorView;
+import bridge.view.InputView;
+import java.util.function.Supplier;
+
+public class InputHandler {
+ private final InputView inputView;
+ private final ErrorView errorVi... | Java | (๊ถ๊ธํด์!)
๊ทธ๋์ ํ์ค๋๊ณผ ๋ฆฌ๋ทฐํด์ค๋ฉด์ ์ด๋ฐ ์ฌ์๋ ๋ก์ง์ while ๋ก ์ฒ๋ฆฌํ ๊น, ์ฌ๊ท๋ก ์ฒ๋ฆฌํ ๊น ๊ณ ๋ฏผํ๋ค๊ฐ ์ ๋ ์ฌ๊ท๋ฅผ ์ ํํ์ต๋๋ค.
๊ทธ๋ฐ๋ฐ ์ฌ๊ท๋ฅผ ์ ํํด๋ ํธ์ถ ๋์ค๊ฐ ๊น์ด์ง๋๊ฒ ์๋๊ณ ๋์ค๊ฐ 1๋ก ๊ณ์ ์ ์ง๋๋ ๊ฒ ๊ฐ๋๋ผ๊ณ ์. (์ด์ฐจํผ catch๋ฅผ ํ๊ณ ์๋ฌ๋ฉ์์ง๋ฅผ ์ถ๋ ฅ์ ํ๋ฏ๋ก)
ํ์ค๋์ ์ฌ๊ท ๋์ while์ ์ ํํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค :) |
@@ -0,0 +1,82 @@
+package bridge.domain;
+
+import bridge.constants.GameValue;
+
+/**
+ * ๋ค๋ฆฌ ๊ฑด๋๊ธฐ ๊ฒ์์ ๊ด๋ฆฌํ๋ ํด๋์ค
+ */
+public class BridgeGame {
+
+ private int retryCount;
+ private MoveResult moveResult;
+
+ public BridgeGame(MoveResult moveResult, int retryCount) {
+ this.moveResult = moveResult;
+ ... | Java | else๋ฌธ์ด ์๋๋ผ์ ์๋ฌด๋๋ return์ ์ถ๊ฐํด ๋ค์ ์กฐ๊ฑด์ ํ์ธํ์ง ์๋๋ก ํ๋๊ฒ ์ข๊ฒ ๋ค์ ! |
@@ -0,0 +1,37 @@
+package bridge.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoveResult {
+ private final List<String> upperBridge;
+ private final List<String> lowerBridge;
+
+ public MoveResult() {
+ this.upperBridge = new ArrayList<>();
+ this.lowerBridge = n... | Java | ํ ๊ทธ ๋ถ๋ถ์ ๋์ณ๋ฒ๋ ธ๋ค์ ..
์ด๋ฒ 5๊ธฐ ์ต์ข
๊น์ง ์น๋ฉด์ ๋๋๊ฑด๋ฐ 5์๊ฐ์ด๋ผ๋ ์๊ฐ์ ์ฝ๋งค์ด์ง ์๊ณ
์ด๋ฐ์ ๊ธฐ๋ฅ ์๊ตฌ ์ฌํญ์ ๊ผผ๊ผผํ ๊ฒํ ํด์ผ ํ๋ค๋ ๊ฒ์ ๋ผ์ ๋ฆฌ๊ฒ ๋๊ผ์ต๋๋ค.. |
@@ -0,0 +1,42 @@
+package bridge.view.handler;
+
+import bridge.domain.Bridge;
+import bridge.domain.BridgeMaker;
+import bridge.view.ErrorView;
+import bridge.view.InputView;
+import java.util.function.Supplier;
+
+public class InputHandler {
+ private final InputView inputView;
+ private final ErrorView errorVi... | Java | ์ฌ๊ท ํธ์ถ๋ก ๊ตฌํํ์ ๋ ์ฝ๋๊ฐ ๊ฐ๊ฒฐํด์ง๋ค๋ ์ฅ์ ์ ๊ฐ์ง๊ณ ์์ง๋ง
ํ์ ๊น์ด๊ฐ ๊น์ด ์ง ๋ ์ํํ ๊ฒ์ด๋ผ ์๊ฐํ์ต๋๋ค.
์ ํธ๋ ๋ง์๋๋ก 1๋ก ์ ์ง๋๋ค๋ฉด ์ด ์ ์ ์๋ฌด๋๋ ์ ์ธํด์ผํ ๊ฒ ๊ฐ๋ค์
ํ์ง๋ง while๋ฌธ์ ์ฌ์ฉํ์ ๋ ๋ฐ๋ณต ํ์๋ฅผ ์ ์ดํ ์ ์๋ค๋ ์ฅ์ ๋ ์๊ธฐ์ while๋ฌธ์ ์ฌ์ฉํ์์ต๋๋ค.
์๋ฅผ ๋ค์ด์ ์ค์ ๋ก๊ทธ์ธ ์ ์ฑ
์ฒ๋ผ ์๋ชป๋ ๊ฐ์ 3ํ ๋๋ 5ํ ์
๋ ฅ ํ์ ๊ฒฝ์ฐ ์
๋ ฅ์ ์ข
๋ฃ ์ํจ๋ค๋๊ฐ ๋ฑ์ ์ํฉ๋ ์๊ฐํด๋ณด์์ต๋๋ค! |
@@ -0,0 +1,42 @@
+package bridge.view.handler;
+
+import bridge.domain.Bridge;
+import bridge.domain.BridgeMaker;
+import bridge.view.ErrorView;
+import bridge.view.InputView;
+import java.util.function.Supplier;
+
+public class InputHandler {
+ private final InputView inputView;
+ private final ErrorView errorVi... | Java | ํ์คํ **3ํ ๊น์ง๋ง ์ฌ์๋๊ฐ ๊ฐ๋ฅํ๋ค** ๋ผ๋ ๋ก์ง์ด ์์ ๊ฒฝ์ฐ์๋ while ๋ฌธ์ผ๋ก ์ฒ๋ฆฌํ๋๊ฒ ์ ์ฐํ๊ฒ ๋์ํ ์ ์๊ฒ ๋ค์!
์ธ์ฌ์ดํธ ๋ฐ๊ณ ๊ฐ๋๋ค :D |
@@ -1,4 +1,4 @@
-import { EstimationInputDTO, Estimation } from '#estimations/estimation.types.js';
+import { EstimationInputDTO, Estimation, IsActivate } from '#estimations/estimation.types.js';
import { IEstimationRepository } from '#estimations/interfaces/estimation.repository.interface.js';
import { PrismaService... | TypeScript | ์๋ง๋ javascript ๋ ๋ฒจ์ด ์๋๋ผ prisma์์ findMany ํด์ค๋ ๋จ๊ณ์์ ์ด ์์
์ ํด์ ๊ฐ์ ธ์ฌ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค. ๋์ค์ ํ ๋ฒ ์ฐพ์๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ๋ค์. |
@@ -1,4 +1,4 @@
-import { EstimationInputDTO, Estimation } from '#estimations/estimation.types.js';
+import { EstimationInputDTO, Estimation, IsActivate } from '#estimations/estimation.types.js';
import { IEstimationRepository } from '#estimations/interfaces/estimation.repository.interface.js';
import { PrismaService... | TypeScript | ๋ค!! ์ฐพ์๋ณด๊ฒ ์ต๋๋ค !! ํ์๋ ์๋ ค์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค!!!! |
@@ -0,0 +1,8 @@
+import "./css/reset.css";
+import "./css/common.css";
+import App from "./App";
+
+addEventListener("DOMContentLoaded", async () => {
+ const app = new App();
+ app.init();
+}); | JavaScript | ์ ํจ์๊ฐ ๋ฐ๋ก ์ฑ์ ๊ตฌ๋์ํค๋ Entry ํฌ์ธํธ๊ตฐ์!
`controller`๋ฅผ ์ด๊ธฐํํ๋ค? ๋ณด๋ค๋ `App`์ ์ด๊ธฐํํ๋ค๋ ๋๋์ด ์ด๋จ๊น์? |
@@ -0,0 +1,14 @@
+import { apiClient } from "./apiClient";
+import { BASE_URL } from "./constants";
+
+export const fetchPopularMovies = async ({ page = 1 }) => {
+ const param = new URLSearchParams({
+ api_key: process.env.TMDB_API_KEY,
+ language: "ko-KR",
+ page,
+ });
+
+ const response = await apiClien... | JavaScript | ์ค ์ข์ต๋๋ค! |
@@ -0,0 +1,34 @@
+import { ApiError } from "./apiError";
+
+export const apiClient = {
+ get: async (url, headers = {}) => {
+ return apiClient.request("GET", url, null, headers);
+ },
+
+ request: async (method, url, body = null, headers = {}) => {
+ const options = {
+ method,
+ headers: {
+ ... | JavaScript | `request()`์ `get()`์ ์ฐจ์ด๋ ๋ฌด์์ด๊ณ ๋๋ ์ด์ ๋ ๋ฌด์์ผ๊น์? |
@@ -0,0 +1,31 @@
+import { ERROR_MSG } from "./constants";
+
+export class ApiError extends Error {
+ constructor(message, details, status = -1) {
+ super(message);
+ this.details = details;
+ this.status = status;
+ }
+
+ static handle(error) {
+ let errMsg;
+ let errDetails;
+
+ switch (parseInt(... | JavaScript | ์ค ์ข์ ์๋์
๋๋ค ๐ |
@@ -0,0 +1,16 @@
+import { mainTitle, mainMoreButton, movieCardsList } from "./index";
+
+export const mainSection = {
+ render() {
+ const element = document.createElement("section");
+ element.classList.add("item-view");
+
+ const title = mainTitle.render();
+ const itemList = movieCardsList.render();
+ ... | JavaScript | [append()](https://developer.mozilla.org/en-US/docs/Web/API/Element/append)๋ฅผ ํ์ฉํด๋ณด์ธ์! |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | ์คํธ?
`exist`๋ก ๊ฒ์ฌํ๋ฉด ๋ฌด์์ด ๋ค๋ฅผ๊น์? |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | 40์ผ๋ก ๊ฒ์ฌํ๋ ์ด์ ๋ ์ด๊ธฐ ๋ฆฌ์คํธ 20 + ์ถ๊ฐ ๋๋ณด๊ธฐ 20์ผ๊น์? |
@@ -0,0 +1,34 @@
+import { ApiError } from "./apiError";
+
+export const apiClient = {
+ get: async (url, headers = {}) => {
+ return apiClient.request("GET", url, null, headers);
+ },
+
+ request: async (method, url, body = null, headers = {}) => {
+ const options = {
+ method,
+ headers: {
+ ... | JavaScript | `request()`๋ ๋งค๊ฐ๋ณ์๋ก ๋ฐ๋ method๋ฅผ ํตํด API ์์ฒญ์ ๋ณด๋ด๋ ํจ์์ด๊ณ , `get()`์ ํด๋น `request()` ํจ์์ `GET`์์ฒญ์ ๋ณด๋ด๋ ํจ์์
๋๋ค.
์ด๋ฒ ๊ณผ์ ์์ GET ์์ฒญ๋ง ์กด์ฌํ์ฌ ์ถ๊ฐํ์ง ์์์ง๋ง ์ถํ์ ๋ค๋ฅธ ๋ฉ์๋ ์์ฒญ์ ์ถ๊ฐํ ์ ์๊ฒ ์์ฑํ์์ต๋๋ค! |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | ์์ฑ๋ `movieCard`์๋ ์ธ๋ค์ผ, ๋ณ์ , ์ ๋ชฉ element๊ฐ `์กด์ฌ`ํ๋ค๋ ์๋ฏธ์์ ์ฌ์ฉํ ๊ฒ ๊ฐ์ต๋๋ค!
๋ค์ ์๊ฐํด๋ณด๋, ํด๋น element๊ฐ ์กด์ฌํ์ง๋ง ๋ณด์ฌ์ง์ง ์๊ฑฐ๋ ์ด๋ค css issue๊ฐ ์๊ธธ ์๋ ์๋ค๋ ์๊ฐ์ `be.visible`๋ก ๋์ฒดํ์์ต๋๋ค. |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | ๋ค ๋ง์ต๋๋ค! ์ด์ ํ
์คํธ์์ 20๊ฐ๊ฐ ๋ ๋๋ง์ด ๋์๊ณ ๋ฒํผ์ ํด๋ฆญํ ํ์, 20๊ฐ๊ฐ ๋ ์ถ๊ฐ๋์ด 40๊ฐ๋ฅผ ๊ฒ์ฌํ๊ฒ ํ์์ต๋๋ค.
์๋กญ๊ฒ ๋ ๋๋ง๋ 20๊ฐ์ ๋ํด์ ํ
์คํธ๋ฅผ ์งํํ๋ ๊ฒ์ด ๋ ์ฌ๋ฐ๋ฅธ ๊ฒ์ฌ์ผ๊น์?
+) ์ถ๊ฐ๋ก, ๋จ์ํ
์คํธ์์๋ ์ํ ๊ฐ์ ํตํด ๋์ถ๋๋ ๊ฐ์ ๊ฒ์ฌํ๋ ๊ณผ์ ์ด ํ
์คํธ์ ํต์ฌ์ด์๋ค๊ณ ์๊ฐ๋๋๋ฐ,
์ด๋ฒ์ e2e์์๋ ๊ฐ์ ์ด์ฉํ์ฌ ๊ฒ์ฌํ๋ ๋ฐฉํฅ๋ณด๋ค ๋ ๋๋ง๋๋ ์์์ ๊ฐ์๋ ์์ฑ ์ฌ๋ถ๋ฅผ ์ค์ฌ์ ์ผ๋ก ์ฝ๋๋ฅผ ์์ฑํ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ฐ ๊ณผ์ ์์ ๋จ์ ํ
์คํธ๋ ๊ฐ ์ค์ฌ, e2e๋ ์ ์ฒด์ ์ธ DOM ๋ ๋๋ง ์ค์ฌ ์ด๋ ๊ฒ ์์ฐ์ค๋ ์๊ฐ์ด ์ด์ด... |
@@ -0,0 +1,40 @@
+package org.sopt.androidseminar1
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.widget.Toast
+import org.sopt.androidseminar1.databinding.SignInBinding
+
+class SignInActivity: AppCompatActivity() {
+ private lateinit var ... | Kotlin | ์ฝํ๋ฆฐ์์๋ ํ์
์ถ๋ก ๊ธฐ๋ฅ์ ์ง์ํด์ฃผ๊ธฐ๋๋ฌธ์
```suggestion
val goSignup = Intent(this, SignUpActivity::class.java)
val goHomeActivity = Intent(this, HomeActivity::class.java )
```
์ด๋ ๊ฒ๋ง ์์ฑํ์
๋ ๊ด์ฐฎ์ต๋๋น~:) |
@@ -0,0 +1,40 @@
+package org.sopt.androidseminar1
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.widget.Toast
+import org.sopt.androidseminar1.databinding.SignInBinding
+
+class SignInActivity: AppCompatActivity() {
+ private lateinit var ... | Kotlin | ์ฌ๊ธฐ์ toString()์ ๊ฒฝ์ฐ ๋นผ์ฃผ์
๋ ๊ด์ฐฎ์ต๋๋ค~!! |
@@ -0,0 +1,40 @@
+package org.sopt.androidseminar1
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.widget.Toast
+import org.sopt.androidseminar1.databinding.SignInBinding
+
+class SignInActivity: AppCompatActivity() {
+ private lateinit var ... | Kotlin | ํ์ฌ setContentView ํจ์๊ฐ ๋๋ฒ ํธ์ถ๋๊ณ ์๋๋ฐ ํ๋๋ ์ง์์ฃผ์
๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์์~!! |
@@ -0,0 +1,40 @@
+package org.sopt.androidseminar1
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.widget.Toast
+import org.sopt.androidseminar1.databinding.SignInBinding
+
+class SignInActivity: AppCompatActivity() {
+ private lateinit var ... | Kotlin | ๋ชจ๋ ๋ก์ง์ ๋ค onCreate์ ๋ฃ๊ธฐ๋ณด๋ค๋ ๊ฐ๋
์ฑ, ์ฌ์ฌ์ฉ์ฑ ์ธก๋ฉด์ ๊ณ ๋ คํด์ ํจ์ํ๋ฅผ ํด์ฃผ์๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์์~!! |
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <corners android:radius="5dip"/>
+
+ <stroke android:width="2dp"
+ android:color="#F658A6"/>
+ <solid android:color="#F658A6"/>
+ <corners
+ android:topLeftRadius="1... | Unknown | dip๋ dp์ ๊ฐ์ ๊ฐ๋
์
๋๋ค! ์์น๋ฅผ dp๋ก ๋ฐ๊ฟ์ฃผ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์~!!! |
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+... | Unknown | View ์ปดํฌ๋ํธ์ id ๊ฐ์ ๋ค์ด๋ฐ์ ์ข ๋ ๊ธฐ๋ฅ์ ๋ง๊ฒ~~ ๊ตฌ์ฒด์ ์ผ๋ก ๋ค์ด๋ฐ ํ๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์์~!! |
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+... | Unknown | ๊ณ ์ dp๋ฅผ ๋์ด๋ ๋๋น๊ฐ์ผ๋ก ์ค ๊ฒฝ์ฐ ํด๋ํฐ ๊ธฐ์ข
์ ๋ฐ๋ผ ๋ด์ฉ์ด ์๋ฆด์๋์๊ณ , ๋ชจ์์ด ์ด์ํ๊ฒ ๋์ฌ ์๋ ์์ต๋๋ค~ ํน์ ๊ณ ์ dp๋ฅผ ๋์ด ๊ฐ์ผ๋ก ์ฃผ์ ํน๋ณํ ์ด์ ๊ฐ ์์๊น์~๐๐ |
@@ -3,8 +3,10 @@ import { ParsedUrlQuery } from "querystring";
import { GetServerSideProps } from "next";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
+import { getReviewStat, getReviews } from "@/lib/api/ReviewService";
import { getTrainerInfo } from "@/lib/api/trainerService... | Unknown | ```js
useQuery(["review-stat", trainerId],
() => getReviewStat(trainerId as string),
{ enabled: !!trainerId,
cacheTime: 5 * 60 * 1000,
staleTime: 5 * 60 * 1000 });
```
๋ก ํด์ฃผ์๋๊ฒ ์ข์๋ณด์ฌ์. |
@@ -3,8 +3,10 @@ import { ParsedUrlQuery } from "querystring";
import { GetServerSideProps } from "next";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
+import { getReviewStat, getReviews } from "@/lib/api/ReviewService";
import { getTrainerInfo } from "@/lib/api/trainerService... | Unknown | ๋ต ์์ ํ๊ฒ ์ต๋๋ค! |
@@ -1,11 +1,29 @@
import { useState } from "react";
+import Header from "./components/Header/Header";
+import Product from "./pages/Product";
+import GlobalStyles from "./styles/Global.style";
+import Toast from "./components/common/Toast/Toast";
+import { QuantityContext } from "./store/QuantityContext";
+import { cr... | Unknown | ์ฌ๊ธฐ ์ด `showToast` ์ํ๋ฅผ ํ ์คํธ ์ปดํฌ๋ํธ๊ฐ ์ฑ
์์ ๊ฐ์ง ์ ์์ง ์์๊น ์ถ์๋๋ฐ, ๊ทธ๋ ๋ค๋ฉด createPortal์ ์ฌ์ฉํ ์ ์๊ฒ ๋๋์..? createPortal์ ์ฌ์ฉํด๋ณด์ง ์์์ ์ ๋ชจ๋ฅด๊ฒ ์ง๋ง, ๋ฏธ๋ฆฌ ์ด์ด๋ ์ ์๋ค๋ฉด ๊ทธ์ชฝ์ผ๋ก ์ํ๋ฅผ ์ฎ๊ฒจ๋ด๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,52 @@
+import { generateBasicToken } from "../util/auth";
+import { CART_ITEMS_ENDPOINT } from "./config";
+
+const USER_PASSWORD = import.meta.env.VITE_USER_PASSWORD;
+const USER_ID = import.meta.env.VITE_USER_ID;
+const token = generateBasicToken(USER_ID, USER_PASSWORD);
+
+export async function requestFet... | TypeScript | ํ์๋ ์๋์ง๋ง ๋ฐ๋ณต๋๋ fetch ๋ก์ง๋ค์ ์ถ์ํํด๋ณด์
๋ ์ข์ ๊ฒ ๊ฐ์์!ใ
ใ
|
@@ -0,0 +1,52 @@
+import { generateBasicToken } from "../util/auth";
+import { CART_ITEMS_ENDPOINT } from "./config";
+
+const USER_PASSWORD = import.meta.env.VITE_USER_PASSWORD;
+const USER_ID = import.meta.env.VITE_USER_ID;
+const token = generateBasicToken(USER_ID, USER_PASSWORD);
+
+export async function requestFet... | TypeScript | chat GPTํํ
'์ด ์ฝ๋ ์ถ์ํ ํด๋ด'ํ๋ฉด ๊ธฐ๊ฐ๋งํ๊ฒ ํด์ฃผ๋๋ผ๊ตฌ์ |
@@ -0,0 +1,10 @@
+import { generateBasicToken } from "../util/auth";
+
+const API_URL = import.meta.env.VITE_API_URL;
+
+export const PRODUCTS_ENDPOINT = `${API_URL}/products`;
+export const CART_ITEMS_ENDPOINT = `${API_URL}/cart-items`;
+
+export const USER_PASSWORD = import.meta.env.VITE_USER_PASSWORD;
+export const ... | TypeScript | api์์ฒญ์ ํ์ํ ๋ณ์๋ค์ด ์ ๋ชจ์ฌ์์ด ๊ด๋ฆฌํ๊ธฐ ํธํ ๊ฒ ๊ฐ๋ค์! ๐ |
@@ -0,0 +1,87 @@
+import { useContext, useEffect, useRef } from "react";
+import { QuantityContext } from "../../store/QuantityContext";
+import useProductList from "../../hooks/useProductList";
+import useCartItemList from "../../hooks/useCartItemList";
+import ProductItem from "../ProductItem/ProductItem";
+import * ... | Unknown | ํ์ด์ง๋ค์ด์
๊ด๋ จ ๋ก์ง๋ ์ปค์คํ
ํ
์ผ๋ก ๋ถ๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,87 @@
+import { useContext, useEffect, useRef } from "react";
+import { QuantityContext } from "../../store/QuantityContext";
+import useProductList from "../../hooks/useProductList";
+import useCartItemList from "../../hooks/useCartItemList";
+import ProductItem from "../ProductItem/ProductItem";
+import * ... | Unknown | ์๋ฌด๋๋ ์ด๋ฒ ๋ฏธ์
์์ ๊ฐ์ฅ ๋ฉ์ธ์ด ๋๋(?) ์ปดํฌ๋ํธ์ธ ๊ฒ ๊ฐ์์. ๋น์ฆ๋์ค ๋ก์ง๊ณผ UI ๋ก์ง์ด ์ข ๋ ์ ๋ถ๋ฆฌ๋๋ฉด ๋์ฑ ์ฝ๊ธฐ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,5 @@
+package model;
+
+public interface State {
+ int execute(int length);
+} | Java | ํ์ฅ ๊ฐ๋ฅ์ฑ์ ์๊ฐํ์ฌ ์ธํฐํ์ด์ค๋ฅผ ๊ตฌํํ์๋ค์!! ๊ฐ ๋ค๋ฅธ ์ํ๋ง๋ค ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด์ Car์์ ๊ฐ์๋ผ์ฐ๋ ๊ฒ๋ ์ ์ ํฉ๋๋ค!! State ํจํด ์ข์ ๊ฒ ๋ฐฐ์๊ฐ๋๋ค ๐ |
@@ -0,0 +1,13 @@
+package function;
+
+import java.util.Random;
+
+public class RandomNumberMaker {
+
+ private static final Random random = new Random();
+ private static final int RANDOM_NUMBER_RANGE = 10;
+
+ public static int getRandomNumber() {
+ return random.nextInt(RANDOM_NUMBER_RANGE);
+ }
+... | Java | getRandomNumber ๊ฐ ํธ์ถ๋ ๋๋ง๋ค ์๋ก์ด Random๊ฐ์ฒด๊ฐ ๋ง๋ค์ด์ง์ง ์์๋ ๋ ๊ฒ ๊ฐ์์!!
๊ทธ๋ฆฌ๊ณ Random๊ฐ์boundary๋ฅผ ํ๋ผ๋ฏธํฐ๋ก ๋ฐ์ ์ด์ ๊ฐ ์์๊น์?? |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | number๋ฅผ Car๋ฅผ ์๋ณํด์ฃผ๋ ๋ฉค๋ฒ๋ก ์ฌ์ฉํ๊ณ ์๋ ๊ฒ ๊ฐ์์!! ์ ๊ทผ์ง์ ์์ final ํค์๋๋ฅผ ๋ถ์ฌ์ฃผ๋ ๊ฒ์ ๋ํด ์ด๋ป๊ฒ ์๊ฐํ์ค๊น์? |
@@ -1,21 +1,18 @@
package view;
-import controller.RacingGame;
import model.Car;
-import java.util.Collections;
import java.util.List;
public class ResultView {
- public static void printTrialResult(List<Car> cars){
- for (Car car : cars){
- System.out.print(car.getName() + " : " + Stri... | Java | ํ์ฌ ์ถ๋ ฅํ๋ ์ฉ๋๋ก ์ง๊ธ --- ์ด๋ ๊ฒ ๋ณด์ฌ์ฃผ๊ณ ์์ง๋ง, ๋์ค์๋ ๋ค๋ฅธ ๊ธฐํธ๋ก ๋ฐ๋์๋ ์์ ๊ฒ ๊ฐ์์!! ์ด ๊ธฐํธ๋ค ๋ฟ๋ง ์๋๋ผ InputView์ ResultView์ ์
์ถ๋ ฅ ๋ฉ์ธ์ง, ๋งค์ง๋๋ฒ๋ค์ ์์ํ ํด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,38 @@
+package controller;
+
+import function.RandomNumberMaker;
+import model.Car;
+import model.State;
+import model.Movable;
+import model.UnMovable;
+
+import java.util.List;
+
+public class CarController {
+
+ private static final int MOVE_CONDITION = 4;
+
+ public void registerCars(List<Car> cars... | Java | ์ ์ฒด์ ์ผ๋ก Car๋ค์ ๊ด๋ฆฌํด์ฃผ๋ ์ญํ ์ ํ๊ณ ์๋ ๊ฒ ๊ฐ์์!
์ ๊ฐ ์๊ฐํ๋ Controller์ ์ญํ ๊ณผ๋ ์กฐ๊ธ ๋ค๋ฅด๋ค๊ณ ์๊ฐ์ด ๋ญ๋๋ค.
์ ๊ฐ ์๊ฐํ๋ Controller์ ์ญํ ์ ์ฌ์ฉ์๊ฐ ์
๋ ฅํ ์์ฒญ๊ฐ์ ๋ฐ์, ์์ฒญ๊ฐ์ ๊ฐ์ง๊ณ ๋น์ฆ๋์ค ๋ก์ง์ ์คํํ๊ณ ํ์ํ ๋ฐ์ดํฐ๋ฅผ ๊ฐ๊ณตํด์ View์๊ฒ ๋ณด๋ด์ฃผ๋ ์ญํ ์ด๋ผ๊ณ ์๊ฐ์ ํฉ๋๋ค.
์ ๋ CarController๋ณด๋ค Cars๊ฐ์ ์ด๋ฆ์ด ๋ ์ด์ธ๋ฆฐ๋ค๊ณ ์๊ฐ์ด ๋๋๋ฐ ํ์ฐ๋์ ์ด๋ป๊ฒ ์๊ฐํ์ค๊น์??
์ด ์๋ฃ ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
https://tecoble.techcourse.co.kr/post/2020-... |
@@ -0,0 +1,47 @@
+package engine;
+
+import controller.CarController;
+import model.Car;
+import view.InputView;
+import view.ResultView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RacingGame {
+
+ private List<Car> cars;
+ private CarController carController;
+ private InputView in... | Java | InputView๋ ์ธ์คํด์ค๋ก ๊ด๋ฆฌํ๊ณ ResultView๋ ์ ํธ๋ฆฌํฐ ํด๋์ค๋ก ์ ์ธํ ์ด์ ๊ฐ ๊ถ๊ธํ๋ค์!! ์ ๋ View๋ฅผ ๊ตฌํ์ ํ ๋, ๊ณ ๋ฏผ์ด ๋ง์ด ๋๋๋ฐ์! View ๊ฐ์ ๊ฒฝ์ฐ์ ์ํ๊ฐ ์์ด์ ์ ํธ๋ฆฌํฐ ํด๋์ค๋ก ๊ตฌํ์ ํด๋ ๋ ๊ฒ ๊ฐ์ง๋ง, ์ ํธ์ฑ ํด๋์ค์๋ ์๊น์ด ์กฐ๊ธ ๋ค๋ฅธ ๋๋๋ ์์ด์์!! ์ ๋ต์ ์๊ฒ ์ง๋ง, ์ ๋ ์ด๋ฒ์ View ๊ตฌํ์ ํ ๋ ์ฑ๊ธํด ํจํด์ ์ฌ์ฉํด๋ณด์์ด์!! ํ์ฐ๋์ด InputView์ OutputView๋ฅผ ๋ค๋ฅด๊ฒ ๊ตฌํํ์ ์ด ๊ถ๊ธํ๋ค์! |
@@ -0,0 +1,38 @@
+package controller;
+
+import function.RandomNumberMaker;
+import model.Car;
+import model.State;
+import model.Movable;
+import model.UnMovable;
+
+import java.util.List;
+
+public class CarController {
+
+ private static final int MOVE_CONDITION = 4;
+
+ public void registerCars(List<Car> cars... | Java | ๋๋ค๊ฐ ๋๋ฌธ์ checkMoveOrStop ๋ฉ์๋๋ฅผ ํ
์คํธ ์ฝ๋ ์์ฑํ๊ธฐ ์ด๋ ค์ ์ ๊ฑฐ์์!!
https://tecoble.techcourse.co.kr/post/2020-05-07-appropriate_method_for_test_by_parameter/
https://tecoble.techcourse.co.kr/post/2020-05-17-appropriate_method_for_test_by_interface/
์๋ฃ ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์์!! ํ์ง๋ง ์ธํฐํ์ด์ค๋ฅผ ๋ถ๋ฆฌํ๋๊ฒ ๋ฌด์กฐ๊ฑด ์ข์ ๋ฐฉ๋ฒ์ ์๋๋ผ๊ณ ์๊ฐ์ด ๋ญ๋๋ค!! ์์ฌํ๋ฉด์ ๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์!! ... |
@@ -0,0 +1,13 @@
+package function;
+
+import java.util.Random;
+
+public class RandomNumberMaker {
+
+ private static final Random random = new Random();
+ private static final int RANDOM_NUMBER_RANGE = 10;
+
+ public static int getRandomNumber() {
+ return random.nextInt(RANDOM_NUMBER_RANGE);
+ }
+... | Java | 1. getRandomNumber ๊ฐ ํธ์ถ๋ ๋๋ง๋ค ์๋ก์ด Random๊ฐ์ฒด๊ฐ ๋ง๋ค์ด์ง์ง ์์๋ ๋ ๊ฒ ๊ฐ์์!!
๋๊ฑด๋ ๋ง์๋๋ก getRandomNumber๋ฅผ ํธ์ถํ ๋๋ง๋ค Random ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ง ์๋ ๊ฒ์ด ์ข๋ค๊ณ ์๊ฐ์ด ๋ญ๋๋ค
Random๊ฐ์ฒด๋ฅผ ์ฑ๊ธํค ํจํด์ ์ด์ฉํ์ฌ ๊ตฌํํ๋ฉด ๋ฆฌ์์ค ๋ถ๋ถ์์ ๋ญ๋น๋ฅผ ์ค์ผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค!! :)
2. Random๊ฐ์ boundary๋ฅผ ํ๋ผ๋ฏธํฐ๋ก ๋ฐ์ ์ด์ ๊ฐ ์์๊น์??
์ ๊ฐ ์๊ฐํ๊ธฐ์๋ ๋์ค์ 10์์ ๋ค๋ฅธ ์ซ์๋ก ๋ฐ๊พธ๊ณ ์ถ์ "๋ณ๊ฒฝ ์ฌํญ"์ ์๊ฐํด๋ดค์ต๋๋ค.
์ฐจ๋ฅผ ์์ง์ด๊ฒ ํ๋ "CarController... |
@@ -0,0 +1,13 @@
+package function;
+
+import java.util.Random;
+
+public class RandomNumberMaker {
+
+ private static final Random random = new Random();
+ private static final int RANDOM_NUMBER_RANGE = 10;
+
+ public static int getRandomNumber() {
+ return random.nextInt(RANDOM_NUMBER_RANGE);
+ }
+... | Java | ```java
private static Random random = new Random();
private static final int RANDOM_BOUNDARY = 10;
public static int getRandomNumber() {
return random.nextInt(RANDOM_BOUNDARY);
}
```
์ด๋ผ๊ณ ํด์ค ์ ์์ ๊ฒ ๊ฐ์์์!!
๋๋ค ๊ฐ์ ์์ฑํด์ฃผ๋ ์ญํ ์ ํ๋ ๊ฒ ๊ฐ์๋ฐ, ๋๋ค๊ฐ์ ๋ฒ์๋ ๋๋ค๊ฐ์ด ์์ฑํด์ฃผ๋ ๊ณณ์์ ์์์ผ ํ์ง ์์๊น ์ถ๋ค์! |
@@ -0,0 +1,13 @@
+package function;
+
+import java.util.Random;
+
+public class RandomNumberMaker {
+
+ private static final Random random = new Random();
+ private static final int RANDOM_NUMBER_RANGE = 10;
+
+ public static int getRandomNumber() {
+ return random.nextInt(RANDOM_NUMBER_RANGE);
+ }
+... | Java | "๋๋ค๊ฐ์ ๋ฒ์๋ ๋๋ค๊ฐ์ด ์์ฑํด์ฃผ๋ ๊ณณ์์ ์์์ผ ํ์ง ์์๊น ์ถ๋ค์"
์ด ๋ถ๋ถ์ด ๋ง๋ ๊ฒ ๊ฐ์ต๋๋ค. ์๊ฐํด๋ณด๋ CarController๊ฐ ๋๋ค๊ฐ์ ๋ฒ์๋ฅผ ์ ํ๋ค๋ฉด ๊ฒฐ๊ตญ Random๊ฐ์ ์์ฑํด์ฃผ๋ ๊ณณ์ ์์กดํ๊ฒ ๋์ด ๊ฒฐํฉ๋๊ฐ ๋์์ง๊ฒ ๋ค์!!
๊ฒฐํฉ๋๋ฅผ ์ค์ด๋ ๋ฐฉ๋ฒ ๋๋ฌด ์ข์ต๋๋ค ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,5 @@
+package model;
+
+public interface State {
+ int execute(int length);
+} | Java | ๊ฐ์ฌํฉ๋๋ค :) |
@@ -1,16 +1,54 @@
package view;
+import java.io.InputStream;
+import java.util.InputMismatchException;
import java.util.Scanner;
-public class InputView{
+public class InputView {
- public static String[] inputCarName(Scanner scanner){
- System.out.println("๊ฒฝ์ฃผํ ์ฐจ์ ์ด๋ฆ์ ์
๋ ฅํ์ธ์. (์ด๋ฆ์ ์ผํ(,) ๊ธฐ์ค์ผ๋ก ๊ตฌ๋ถ)");
- ... | Java | ์์๊ฐ ์
๋ ฅ๋์ ๊ฒฝ์ฐ์ ์์ธ๊ฐ ๋์ ธ์ง๋๋ก ์ฒ๋ฆฌ๋ฅผ ํด์ฃผ์
จ๋ค์! ์์์ผ ๊ฒฝ์ฐ ๋ง๊ณ ๋ ์ซ์๊ฐ ์๋ ๊ฐ์ด ์
๋ ฅ ๋์ ๊ฒฝ์ฐ๋ ์์ธ๊ฐ ๋์ ธ์ง๋๋ก ๋ช
์์ ์ผ๋ก ์ฒ๋ฆฌํด์ฃผ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -1,16 +1,54 @@
package view;
+import java.io.InputStream;
+import java.util.InputMismatchException;
import java.util.Scanner;
-public class InputView{
+public class InputView {
- public static String[] inputCarName(Scanner scanner){
- System.out.println("๊ฒฝ์ฃผํ ์ฐจ์ ์ด๋ฆ์ ์
๋ ฅํ์ธ์. (์ด๋ฆ์ ์ผํ(,) ๊ธฐ์ค์ผ๋ก ๊ตฌ๋ถ)");
- ... | Java | ์ ๋ ๋๊ฑด๋๊ป ๋ฐฐ์ด๊ฑด๋ฐ if๋ฌธ ๋ฐ๋๊ฐ ํ ๋ฌธ์ฅ์ด๋๋ผ๋ ์ค๊ดํธ {}๋ฅผ ์ฌ์ฉํด์ฃผ๋๊ฒ์ด ๊ด๋ก๋ผ๊ณ ํ๋ค์! |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | ์ ๊ทผ์ ํ์๋ ๊ฐ๋ฅํ ๊ฐ์ฅ ์ข์ ๋ฒ์๋ก ์ ์ธํด์ฃผ๋๊ฒ์ด ์ข๋ค๊ณ ํฉ๋๋ค. number, length, state ๊ฐ์ ๊ฒฝ์ฐ์๋ private๋ก ์ ์ธํด์ฃผ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,38 @@
+package controller;
+
+import function.RandomNumberMaker;
+import model.Car;
+import model.State;
+import model.Movable;
+import model.UnMovable;
+
+import java.util.List;
+
+public class CarController {
+
+ private static final int MOVE_CONDITION = 4;
+
+ public void registerCars(List<Car> cars... | Java | RANDOM_NUMBER_RANGE ๋ ์ด๋จ๊น์? |
@@ -1,66 +0,0 @@
-package controller;
-
-import model.Car;
-import util.RandomGenerator;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class RacingGame {
-
- public static final int CRITICAL_POINT = 5;
- public static final int MAX_NAME_LENGTH = 5;
-
- public v... | Java | ๋ฉ์๋๋ช
์ ํ์๋ฅผ ํํํ๋ ๋์ฌ๋ก ์์ํ๋๊ฒ ์ด๋จ๊น์? |
@@ -1,66 +0,0 @@
-package controller;
-
-import model.Car;
-import util.RandomGenerator;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class RacingGame {
-
- public static final int CRITICAL_POINT = 5;
- public static final int MAX_NAME_LENGTH = 5;
-
- public v... | Java | check ๋ ๋ฌด์์ ์ฒดํฌํ๋ค๋๊ฑด์ง ์๊ธฐ ์ด๋ ค์ด ๊ฒ ๊ฐ์์~ ๋ด๋ถ์์๋ง ํ์ฉ๋๋ ํด๋์ค๋ฉด private ํค์๋๋ฅผ ๋ถ์ด๊ณ ๋ฉ์๋๋ช
์ ์ข ๋ ํ์ด์จ๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,8 @@
+package model;
+
+public class Movable implements State {
+ @Override
+ public int execute(int length) {
+ return length + 1;
+ }
+} | Java | ~able ์ interface ์ ์ ๋ฏธ์ฌ๋ก ํ์ฉ๋๋๋ฐ
๊ตฌํ์ฒด์ ๋ค์ด๋ฐ์ธ ๊ฒฝ์ฐ์๋ ์ด ํ์
์ด ๋ฌด์์ด ๊ฐ๋ฅํ์ง๋ณด๋ค๋ ๋ฌด์์ ํ๋์ง ๊ตฌ์ฒด์ ์ธ ๋จ์ด๋ฅผ ํ์ฉํ๋ฉด ์ด๋จ๊น์?
์๋ฅผ ๋ค์ด Forward ๋ Stop ์ฒ๋ผ์ |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | ์๋์ฐจ์ ์์น๋ฅผ ๋ํ๋ด๋ ๋ณ์ ๊ฐ์๋ฐ position ์ ์ด๋จ๊น์? |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | ์๋ฏธ๊ฐ ๋ถ๋ถ๋ช
ํ number ๋ณด๋ค๋ ์๋ณ์ด ๊ฐ๋ฅํ ๊ฐ์ ํํํ๋ id ๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค ~ |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | Num ๋ ์ค์๋ง์ด๋ number, no ๋ก ํต์ผํด๋ณด๋ฉด ์ด๋จ๊น์?
๊ทธ๋ฆฌ๊ณ getter ๋ get{field๋ช
} ์ด๋ผ๋ java bean ์ปจ๋ฒค์
์ด ์์ผ๋ ๋ฐ๋ฅด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | count ๋ฅผ ์ด๋์ํจ๋ค ๋ผ๋ ๋ป์ ๋ฉ์๋๋ช
์ธ ๊ฒ ๊ฐ์์~ getLength ๋ ์ด๋จ๊น์? |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | cmd ์ ์๋ฏธ๊ฐ ๋ฌด์์ผ๊น์? command? ์คํฐ๋ ๊ท์น์ ์ถ์ฝํ ๋จ์ด๋ฅผ ์ฌ์ฉํ์ง ๋ง์~ ์
๋๋ค |
@@ -2,22 +2,28 @@
public class Car{
- private String name;
- private int position = 0;
+ long number;
+ int length;
+ State state;
- public Car(String name){
- this.name = name;
+ public Car(long number) {
+ this.number = number;
+ length = 0;
}
- public String... | Java | state ์ ๊ธฐ๋ณธ๊ฐ์ด ์ธํ
๋์ด์์ง ์์๋ฐ, ์ด ํด๋์ค๊ฐ state ํจํด์ ์ ์ฉํ ๊ฒ์ธ์ง ๋ชจ๋ฅด๋ ์ฌ๋์ car.move() ๋ฅผ ์ฌ์ฉํ์ ๊ฒฝ์ฐ์ NPE ๊ฐ ๋ฐ์ํ์ง ์์๊น์~? |
@@ -0,0 +1,38 @@
+package controller;
+
+import function.RandomNumberMaker;
+import model.Car;
+import model.State;
+import model.Movable;
+import model.UnMovable;
+
+import java.util.List;
+
+public class CarController {
+
+ private static final int MOVE_CONDITION = 4;
+
+ public void registerCars(List<Car> cars... | Java | ์ํ ํจํด์ ํ์ฉํ์ ๊ฒ ์ ์ ํ๋ค์~
๋ค๋ง ์ ์ง๊ณผ ์ ์ง ๋ฟ์ด๊ณ ์ํ์ ์ ์ด๊ฐ ์์ ๋ฟ๋๋ฌ ์กฐ๊ฑด๋ฌธ์ด ๋ณต์กํ์ง ์์ ์ํ์์ ์ ์ฉํ๊ธฐ์ ๊ณผํ์ง ์๋๋ผ๋ ๊ณ ๋ฏผ๋ ํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์.
move(int condition) ๋ฉ์๋์์ ๋ถ๊ธฐ์ณ์ ์ ์ง, ์ ์ง๋ฅผ ์ํํ๋ ๊ฒ๊ณผ,
์์ง์ ๊ด๋ จ ์ํ๋ฅผ ์ ์ํ๊ณ , CarController ์์ ๋ถ๊ธฐ์ณ์ condition ์ฒดํฌํ๊ณ ์์ง์ ๊ด๋ จ ์ํ๋ฅผ ๋ฐ๊ฟ์ฃผ๋๋ก ๊ตฌํํ ๋ค์, Car.move ์์ ๋ ๋ถ๊ธฐ๋ฅผ ํตํด ์ํ๊ฐ์ ์ฒดํฌํด์ ํ์๋ฅผ ๊ฒฐ์ ํ๋ ๊ฒ(์ ๊ฐ์ ํ ๊ฒ์ด ์ํ ํจํด ์ ์ฉ๋ฒ์ ์ธ๋ฐ)
๋ฌด์์ด ๋ ๋ณต์กํ๊ณ ์ฌํํ์ง ๊ณ ๋ฏผํด๋ณด์
๋... |
@@ -0,0 +1,5 @@
+package model;
+
+public interface State {
+ int execute(int length);
+} | Java | state ๋ฅผ ์ ์ฉํ ๋ค๋ฅธ ์ผ์ด์ค๋ฅผ ์๊ฐํด์ ์ข ๋ ๊ตฌ์ฒด์ ์ธ ์ธํฐํ์ด์ค๋ช
์ ์ฌ์ฉํด๋ณด๋ฉด ์ด๋จ๊น์? MoveState? |
@@ -1,16 +1,54 @@
package view;
+import java.io.InputStream;
+import java.util.InputMismatchException;
import java.util.Scanner;
-public class InputView{
+public class InputView {
- public static String[] inputCarName(Scanner scanner){
- System.out.println("๊ฒฝ์ฃผํ ์ฐจ์ ์ด๋ฆ์ ์
๋ ฅํ์ธ์. (์ด๋ฆ์ ์ผํ(,) ๊ธฐ์ค์ผ๋ก ๊ตฌ๋ถ)");
- ... | Java | ์ฝ๋์ ํฌ๋งทํ
๋ ์ปจ๋ฒค์
์ ์ผ์ข
์
๋๋ค.
intellij ์ ์ฝ๋ ํฌ๋งทํ
๋จ์ถํค๋ฅผ ํ์ฉํด์ ์ ๋ ฌํด๋ณด์๋ฉด ์ด๋จ๊น์? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.