code
stringlengths
41
34.3k
lang
stringclasses
8 values
review
stringlengths
1
4.74k
@@ -0,0 +1,102 @@ +import Foundation +import RxSwift + +enum NetworkError: Error, LocalizedError { + case statusCodeError + case unknownError + case urlIsNil + + var errorDescription: String? { + switch self { + case .statusCodeError: + return "์ •์ƒ์ ์ธ StatusCode๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค." + c...
Swift
NetworkProvider().request(api: api) ์˜ ๋ชจ์–‘์ด ๋‚˜์˜ฌ ๊ฒƒ ๊ฐ™์€๋ฐ์š”. ๋งค ์ผ€์ด์Šค๋งˆ๋‹ค ๋‹ค๋ฅธ NetworkProvider๊ฐ€ ํ•„์š”ํ•ด ๋ณด์ด์ง€๋„ ์•Š๊ณ ์š”. NetworkProvider ๋ฅผ ๋งค๋ฒˆ ์–ป์–ด์™€์•ผ ํ•˜๋Š”๊ฒŒ ๋ฒˆ๊ฑฐ๋กœ์™€๋ณด์—ฌ์š”. api.execute()๋Š” ์–ด๋–จ๊นŒ์š”. excute ์•ˆ์— NetworkProvider์˜ ๋กœ์ง์„ ๋‹ด๋Š”๊ฑฐ์ฃ . ์„œ๋กœ ๋‹ค๋ฅธ provider๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋ฉด, APIProtocol ๋‚ด๋ถ€์— ๋ช…์‹œํ•˜๋Š” ์‹์œผ๋กœ ํ•ด๊ฒฐํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๊ณ ์š”.
@@ -0,0 +1,102 @@ +import Foundation +import RxSwift + +enum NetworkError: Error, LocalizedError { + case statusCodeError + case unknownError + case urlIsNil + + var errorDescription: String? { + switch self { + case .statusCodeError: + return "์ •์ƒ์ ์ธ StatusCode๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค." + c...
Swift
Observable.create ๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์•„๋ณด์ž…๋‹ˆ๋‹ค.
@@ -0,0 +1,52 @@ +import Foundation + +struct OpenMarketBaseURL: BaseURLProtocol { + var baseURL = "https://market-training.yagom-academy.kr/" +} + +struct HealthCheckerAPI: Gettable { + var url: URL? + var method: HttpMethod = .get + + init(baseURL: BaseURLProtocol = OpenMarketBaseURL()) { + sel...
Swift
var / let ํ™•์ธ ๋ฐ”๋ž๋‹ˆ๋‹ค.
@@ -0,0 +1,37 @@ +import UIKit + +struct FlowCoordinator { + // MARK: - Properties + weak private var navigationController: UINavigationController? + private var productListViewController: ProductListViewController! + private var productListViewModel: ProductListViewModel! + private var menuSegmentedCont...
Swift
class type์„ property๋กœ ๋“ค๊ณ ์žˆ์œผ๋‹ˆ, struct๋ณด๋‹ค๋Š” class๊ฐ€ ์–ด์šธ๋ ค๋ณด์ž…๋‹ˆ๋‹ค.
@@ -0,0 +1,37 @@ +import UIKit + +struct FlowCoordinator { + // MARK: - Properties + weak private var navigationController: UINavigationController? + private var productListViewController: ProductListViewController! + private var productListViewModel: ProductListViewModel! + private var menuSegmentedCont...
Swift
!๋Š” ์“ฐ์ง€ ์•Š๋Š”๊ฑธ๋กœ ํ•ด์š”.
@@ -0,0 +1,37 @@ +import UIKit + +struct FlowCoordinator { + // MARK: - Properties + weak private var navigationController: UINavigationController? + private var productListViewController: ProductListViewController! + private var productListViewModel: ProductListViewModel! + private var menuSegmentedCont...
Swift
FlowCoordinator ๊ฐ€ ๋‹ค๋ฅด๊ฒŒ ๋งํ•˜๋ฉด AppLevel์˜ Coordinator๋กœ ์ดํ•ด๋˜๋Š”๋ฐ์š”. ProductList์˜ ๋กœ์ง๊ณผ ์˜์กด์„ฑ์ด ์ปค์„œ ProductList ์ „์šฉ Coordinator ์ฒ˜๋Ÿผ ๋ณด์ž…๋‹ˆ๋‹ค. ์ €๋ผ๋ฉด ProductListCoordinator ์ •๋„๋ฅผ ๋งŒ๋“ค์–ด์„œ ProductList ๋กœ์ง์„ ๋ชจ๋“ˆํ™”ํ•˜๊ณ ์š”. FlowCoordinator์˜ rootCoordinator๋ฅผ ProductListCoordinator ๋กœ ๋‘์–ด์„œ FlowCoordinator์™€ ProductListCoordinator์˜ ๊ด€๊ณ„๋ฅผ ๋ถ„๋ฆฌํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,46 @@ +import UIKit + +class ProductDetailImageCell: UICollectionViewCell { + // MARK: - Properties + private let productImageView: UIImageView = { + let imageView = UIImageView() + imageView.translatesAutoresizingMaskIntoConstraints = false + imageView.contentMode = .scaleAspectFi...
Swift
์ด ๊ฒฝ์šฐ init์— param์ด ์—†์œผ๋ฏ€๋กœ, init coder ์‚ด๋ ค๋„ ๋  ๊ฒƒ ๊ฐ™์•„์š”. required init?(coder: NSCoder) { super.init(coder: coder) configureUI() }
@@ -0,0 +1,57 @@ +import Foundation +import RxSwift +import UIKit + +class ProductDetailViewModel { + // MARK: - Nested Types + struct Input { + let invokedViewDidLoad: Observable<Void> + let cellDidScroll: Observable<IndexPath> + } + + struct Output { + let product: Observable<Deta...
Swift
inputObserver ์™€ fetchProduct ๋ฅผ flatMap์œผ๋กœ ์—ฎ์–ด์„œ product observer๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค์š”. ๊ณ ๋ฏผํ•ด๋ด์ฃผ์„ธ์š”. subscribe๋Š” ๊ผญ ํ•„์š”ํ•œ ์œ„์น˜์—๋งŒ ํ•ด์ฃผ์„ธ์š”.
@@ -0,0 +1,57 @@ +import Foundation +import RxSwift +import UIKit + +class ProductDetailViewModel { + // MARK: - Nested Types + struct Input { + let invokedViewDidLoad: Observable<Void> + let cellDidScroll: Observable<IndexPath> + } + + struct Output { + let product: Observable<Deta...
Swift
output ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ๋งŽ์ด ๋ณด์ด๋Š”๋ฐ์š”. ๋งˆ์น˜ inout ํ‚ค์›Œ๋“œ์™€ ๋น„์Šทํ•œ ๊ธฐ๋Šฅ์„ ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ข‹์€ ์ฝ”๋“œ๋กœ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. output์„ ํ•˜๊ณ ์‹ถ๋‹ค๋ฉด return type์„ ์“ฐ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
@@ -0,0 +1,53 @@ +import UIKit + +final class BannerCell: UICollectionViewCell { + // MARK: - Properties + private let stackView: UIStackView = { + let stackView = UIStackView() + stackView.style(axis: .vertical, alignment: .fill, distribution: .fill) + return stackView + }() + private ...
Swift
reusable cell์€ storable property๋ฅผ ๋“ค๊ณ ์žˆ์„ ์ด์œ ๊ฐ€ ๊ฑฐ์˜ ์—†์Šต๋‹ˆ๋‹ค. cell์€ UI ๊ป๋ฐ๊ธฐ ์ผ ๋ฟ์ด์ง€, ํŠน์ • ๋ฐ์ดํ„ฐ๋ฅผ ๋Œ€ํ‘œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. apply์ชฝ์—๋Š” UI ์„ธํŒ…์„ ์œ„ํ•œ ViewModel ๋งŒ ์ „๋‹ฌ ํ•˜๋ฉด ๋˜๊ณ ์š”. ์ด cell์ด ์–ด๋–ค productID๋กœ ๊ตฌ์„ฑ๋˜์—ˆ๋Š”์ง€ ๊ถ๊ธˆํ•˜๋‹ค๋ฉด, cell์˜ indexPath๋ฅผ ์ด์šฉํ•ด์„œ ์ง์ ‘ ์–ป์–ด๋‚ด๋ฉด ๋ฉ๋‹ˆ๋‹ค.
@@ -0,0 +1,53 @@ +import UIKit +import RxSwift +import RxCocoa + +final class FooterView: UICollectionReusableView { + // MARK: - Properties + private let bannerPageControl: UIPageControl = { + let pageControl = UIPageControl() + pageControl.translatesAutoresizingMaskIntoConstraints = false + ...
Swift
bind๊ฐ€ N๋ฒˆ ํ˜ธ์ถœ๋˜์—ˆ์„ ๋•Œ subscribe๊ฐ€ N๋ฒˆ ๋  ๊ฐ€๋Šฅ์„ฑ์€ ์—†์„์ง€ ๊ฒ€ํ†  ๋ฐ”๋ž๋‹ˆ๋‹ค.
@@ -0,0 +1,176 @@ +import UIKit + +final class GridListCell: UICollectionViewCell { + // MARK: - Nested Types + private enum Design { + static let nameLabelTextColor: UIColor = .black + static let stockLabelTextColor: UIColor = .systemOrange + static let priceLabelTextColor: UIColor = .system...
Swift
์ €๋Š” Design์„ ํŒŒ์ผ ์ตœ ํ•˜๋‹จ์œผ๋กœ ๋บด๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•œ ๋ฒˆ ์ž‘์„ฑ๋˜๋ฉด ๋ณผ ์ผ์ด ๊ฑฐ์˜ ์—†๋Š” ์ฝ”๋“œ๋ผ์„œ์š”.
@@ -0,0 +1,22 @@ +import UIKit + +extension UIStackView { + func style(axis: NSLayoutConstraint.Axis, + alignment: UIStackView.Alignment, + distribution: UIStackView.Distribution, + spacing: CGFloat = .zero) { + self.translatesAutoresizingMaskIntoConstraints = false +...
Swift
์ด๋ถ€๋ถ„์€ ํ”„๋กœํผํ‹ฐ๋ฅผ ํด๋กœ์ €๋กœ ์ƒ์„ฑํ•˜๋Š” ๋ถ€๋ถ„์—์„œ ๋ฐ˜๋ณต๋˜๋Š” ๋ถ€๋ถ„์ด ๋งŽ์•„ ๋ฉ”์„œ๋“œ๋ฅผ ํ†ตํ•ด ํ”„๋กœํผํ‹ฐ๋ฅผ setํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค!!
@@ -0,0 +1,24 @@ +import UIKit + +extension UIImageView { + func loadImage(of key: String) { + let cacheKey = NSString(string: key) + if let cachedImage = ImageCacheManager.shared.object(forKey: cacheKey) { + self.image = cachedImage + return + } + + Dispatch...
Swift
๋ง์”€ํ•ด์ฃผ์‹ ๋Œ€๋กœ ๋ฉ”์„œ๋“œ์ด๋ฆ„๋งŒ ๋ด์„œ๋Š” Cache ๊ธฐ๋Šฅ์„ ๋‚ดํฌํ•˜๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์—†์–ด์„œ loadCachedImage(of key: String)๋กœ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค!
@@ -0,0 +1,120 @@ +import UIKit + +struct MultipartFormData { + private(set) var boundary: String + let contentType: String + private(set) var body: Data = Data() + + init(uuid: String = UUID().uuidString) { + self.boundary = "Boundary-\(uuid)" + self.contentType = "multipart/form-data; bo...
Swift
createFormData์™€ createImageFormData ๋ชจ๋‘ create๋กœ ๋ฉ”์„œ๋“œ ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•˜๊ณ , ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ํ†ตํ•ด ๊ตฌ๋ถ„ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์—์„œ Postํ•˜๋Š” ํƒ€์ž…์ด product ๋ฐ–์— ์—†์œผ๋ฏ€๋กœ item์€ product๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๊ตฌ์ฒดํ™”์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,52 @@ +import Foundation + +struct OpenMarketBaseURL: BaseURLProtocol { + var baseURL = "https://market-training.yagom-academy.kr/" +} + +struct HealthCheckerAPI: Gettable { + var url: URL? + var method: HttpMethod = .get + + init(baseURL: BaseURLProtocol = OpenMarketBaseURL()) { + sel...
Swift
๋ชจ๋‘ initializer์—์„œ ์ง€์ •ํ•˜๋Š” ํ”„๋กœํผํ‹ฐ๋ผ์„œ let์œผ๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,22 @@ +package kr.wooco.woocobe.placereview.adapter.out.presistence.entity + +import jakarta.persistence.Column +import jakarta.persistence.Entity +import jakarta.persistence.Id +import jakarta.persistence.Table +import kr.wooco.woocobe.common.infrastructure.storage.Tsid +import kr.wooco.woocobe.common.infra...
Kotlin
`place_Review_id` -> `place_review_id` ๋Œ€๋ฌธ์ž ์—†์• ์ฃผ์„ธ์œ 
@@ -1,3 +1,5 @@ -import date from './date.svg'; -export * from './Eyes'; +import date from "./date.svg"; +export * from "./Eyes"; export { date }; +import Logo from "./Logo.svg"; +export { Logo };
TypeScript
svg๋Š” import logo from './logo.svg'; export {logo}; ์ด๋Ÿฐ ์‹์œผ๋กœ ํ•ด์ฃผ์–ด์•ผํ• ํ…๋ฐ ์ง€๊ธˆ ์ •์ƒ ์ž‘๋™ํ•˜์‹œ๋‚˜์š”? ๊ทธ๋ฆฌ๊ณ  ์ด๋ฏธ์ง€๋Š” ์†Œ๋ฌธ์ž๋กœ ๋„ค์ด๋ฐํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,65 @@ +import styled from "styled-components"; +import { Logo } from "../../assets"; +import { useState } from "react"; +import { LoginBtn } from "../header/LoginBtn"; +import { font } from "../../theme"; + +export const Header = () => { + const [isLogined, setIsLogined] = useState<boolean>(false); + + ret...
Unknown
์ด๊ฑด ์™œ ์ด๋ ‡๊ฒŒ ๋ถˆ๋Ÿฌ์˜ค์‹œ๋‚˜์šฉ
@@ -37,6 +37,8 @@ public PageReviewRes<ReviewRes> getPagedReviewsByTemplestayId(Long templestayId, throw new TemplestayCoreException(ErrorCode.REVIEW_NOT_FOUND); } + Long count = reviewRepository.countByTempleName(templeName); + List<ReviewRes> reviewDtos = reviews.getContent().s...
Java
๋ฆฌ๋ทฐ ์ „์ฒด ๊ฐœ์ˆ˜๋ฅผ ๋ฐ˜ํ™˜ํ•˜์—ฌ ํ”„๋ก ํŠธ์—์„œ ํŽ˜์ด์ง• ์ฒ˜๋ฆฌ์— ๋„์›€์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค! ๊ตฟ
@@ -0,0 +1,23 @@ +package kdt.prgrms.kazedon.everevent.common; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import kdt.prgrms.kazedon.everevent.domain.user.UserType; +import org.springframework.security.test.context.support.WithSecurityContext; + +@Retention(RetentionPolicy.R...
Java
Long ์œผ๋กœ ํ•˜๋Š”๊ฒŒ ๋” ์ข‹์•„๋ณด์ด๋„ค์š” :)
@@ -0,0 +1,23 @@ +package kdt.prgrms.kazedon.everevent.common; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import kdt.prgrms.kazedon.everevent.domain.user.UserType; +import org.springframework.security.test.context.support.WithSecurityContext; + +@Retention(RetentionPolicy.R...
Java
์•— ๊ทธ๋Ÿฌ๋„ค์š”! ๊ฐ์‚ฌํ•จ๋‹ˆ๋‹น ๐Ÿ‘๐Ÿ‘
@@ -0,0 +1,185 @@ +package kdt.prgrms.kazedon.everevent.domain.like; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.LocalDateTime; +import java.util.Optional; +import kdt.prgrms.kazedon.everevent.domain.event.Event; +import kdt.prgrms.kazedon.everevent.domain.event.repository.EventRepo...
Java
์•„๋ž˜์„œ ๊ฒ€์ฆํ•˜๋‹ˆ๊น ์ด๊ฑด ๊ดœ์ฐฎ์ง€ ์•Š์„๊นŒ์š”?
@@ -0,0 +1,164 @@ +package kdt.prgrms.kazedon.everevent.domain.review; + +import static org.assertj.core.api.Assertions.*; + +import java.time.LocalDateTime; +import kdt.prgrms.kazedon.everevent.domain.event.Event; +import kdt.prgrms.kazedon.everevent.domain.event.repository.EventRepository; +import kdt.prgrms.kazedon....
Java
assertAll()์„ ํ•œ๋ฒˆ ์จ๋ณด๋ฉด ์ข‹์„๊ฑฐ ๊ฐ™๋„ค์š” :)
@@ -0,0 +1,197 @@ +package kdt.prgrms.kazedon.everevent.service; + +import static org.assertj.core.api.Assertions.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willDoNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.time....
Java
ํ”„๋กœ์ ํŠธ๊ฐ€ ๊ฑฐ๋Œ€ํ•ด์ง€๋ฉด์„œ ํ…Œ์ŠคํŠธ์— ๋Œ€ํ•ด์„œ ์ค‘๋ณต์ฝ”๋“œ๊ฐ€ ๊ต‰์žฅํžˆ ๋งŽ์•„ ์ง€์ฃ  :) TestFixture๋ผ๋Š”๊ฑธ ํ•œ๋ฒˆ ์ ์šฉํ•ด๋ณด๋ฉด ์–ด๋– ์‹ ๊ฐ€์š”?
@@ -0,0 +1,197 @@ +package kdt.prgrms.kazedon.everevent.service; + +import static org.assertj.core.api.Assertions.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willDoNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.time....
Java
์˜ค ํ•œ๋ฒˆ ์ ์šฉํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!! Fixture ํด๋ž˜์Šค์— static ๋ณ€์ˆ˜๋กœ ๊ฐ์ฒด ์ƒ์„ฑํ•ด๋†“๊ณ  ์‚ฌ์šฉํ•˜๋ฉด ์ฝ”๋“œ๊ฐ€ ๋งŽ์ด ๊น”๋”ํ•ด์ง€๊ฒ ๋„ค์šฉ ๐Ÿ˜ธ
@@ -0,0 +1,164 @@ +package kdt.prgrms.kazedon.everevent.domain.review; + +import static org.assertj.core.api.Assertions.*; + +import java.time.LocalDateTime; +import kdt.prgrms.kazedon.everevent.domain.event.Event; +import kdt.prgrms.kazedon.everevent.domain.event.repository.EventRepository; +import kdt.prgrms.kazedon....
Java
๋„ต!
@@ -0,0 +1,185 @@ +package kdt.prgrms.kazedon.everevent.domain.like; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.LocalDateTime; +import java.util.Optional; +import kdt.prgrms.kazedon.everevent.domain.event.Event; +import kdt.prgrms.kazedon.everevent.domain.event.repository.EventRepo...
Java
๊ทธ๋Ÿฌ๋„ค์—ฌ..ใ…  ์‚ญ์ œํ•ด๋„ ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์ˆจ๋‹ค
@@ -1,2 +1,219 @@ -.MainKang { +@mixin center { + display: flex; + justify-content: center; +} + +@mixin middle { + display: flex; + flex-direction: column; +} + +@mixin boxes { + width: 100%; + margin: 5px auto; + border: 1px solid rgb(220, 219, 219); + background-color: white; +} + +.entire-area { + @include...
Unknown
๋‹ค๋ฅธ ๋ถ€๋ถ„์—์„œ๋Š” ์ž˜ ํ•ด์ฃผ์…จ๋Š”๋ฐ, ์„ ํƒ์ž ๊ฐ„์—๋Š” ํ•œ ์ค„ ๋„์›Œ์ฃผ์„ธ์š”! ๊ทธ๋ฆฌ๊ณ  `id` ์„ ํƒ์ž๋ณด๋‹ค๋Š”, `className` ์„ ํ™œ์šฉํ•ด์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ์ด์œ ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. - HTML์—์„œ `id` ๋Š” ๋ฌธ์„œ ๋‚ด์—์„œ ์œ ์ผํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ด์œ ๋กœ ๋‹จ์ผ ์š”์†Œ๋ฅผ ๋‹ค๋ฃจ๋Š” ๊ฒฝ์šฐ `id`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - ํ•˜์ง€๋งŒย ์ •๋ง๋กœ ํ•ด๋‹น ์š”์†Œ์— ๋Œ€ํ•œ ์ด๋ฒคํŠธ๋‚˜ ์Šคํƒ€์ผ ํ•ธ๋“ค๋ง์ด ํ”„๋กœ์ ํŠธ ์ „์ฒด์—์„œ ๋‹จ ํ•œ๋ฒˆ๋งŒ ์‚ฌ์šฉ ๋˜๋Š”์ง€ย ์ถฉ๋ถ„ํžˆ ๊ณ ๋ฏผํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ์ปดํฌ๋„ŒํŠธ๋Š” ์žฌ์‚ฌ์šฉ ๋  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ™์€ ์š”์†Œ๊ฐ€ ์—ฌ๋Ÿฌ๋ฒˆ ์ƒ์„ฑ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ด์œ ๋กœ ๋ณดํ†ต์˜ ๊ฒฝ์šฐ์—๋Š” `classN...
@@ -1,9 +1,30 @@ import React from 'react'; import './LoginKang.scss'; +import LoginValidation from './components/LoginValidation'; class LoginKang extends React.Component { render() { - return <div className="LoginKang">LoginKang</div>; + return ( + <div className="whole-area"> + <section> + ...
JavaScript
kebab-case์™€ camelCase๋ฅผ ํ˜ผ์šฉํ•˜๊ณ  ๊ณ„์‹œ๋„ค์š”! ํ†ต์ผํ•ด์„œ ์‚ฌ์šฉํ•ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.
@@ -1,9 +1,30 @@ import React from 'react'; import './LoginKang.scss'; +import LoginValidation from './components/LoginValidation'; class LoginKang extends React.Component { render() { - return <div className="LoginKang">LoginKang</div>; + return ( + <div className="whole-area"> + <section> + ...
JavaScript
ํ™•์ธ ํ›„ ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค :)
@@ -1,2 +1,219 @@ -.MainKang { +@mixin center { + display: flex; + justify-content: center; +} + +@mixin middle { + display: flex; + flex-direction: column; +} + +@mixin boxes { + width: 100%; + margin: 5px auto; + border: 1px solid rgb(220, 219, 219); + background-color: white; +} + +.entire-area { + @include...
Unknown
ํ™•์ธ ํ›„ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹น
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
์†กํ˜„๋‹˜, validation์„ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ๋Š” false๋กœ ์ฃผ์‹  ๋’ค ์กฐ๊ฑด (in.includes('@') && pwd.length>=5) ์ด true์ผ ๊ฒฝ์šฐ validation๋„ true๋กœ ๋ณ€ํ•ด์„œ ๋ฒ„ํŠผ์ด ํ™œ์„ฑํ™” ๋˜๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜์‹  ๊ฒƒ์ด์ฃ ? ์ €๋Š” render()์•ˆ์˜ ๋ฒ„ํŠผ์— ์กฐ๊ฑด์— ๋”ฐ๋ผ ์‚ผํ•ญ ์—ฐ์‚ฐ์ž๋กœ class๋ช…์„ ์ฃผ๊ณ , ์Šคํƒ€์ผ๋ง์„ ๋‹ค๋ฅด๊ฒŒ ํ•ด์„œ ์ƒ‰์ƒ๋งŒ ๋ณ€๊ฒฝ๋์—ˆ๋Š”๋ฐ ๋ฒ„ํŠผ ํ™œ์„ฑํ™” ์ž์ฒด๋ฅผ ๊ตฌํ˜„ํ•˜์‹  ๊ฒƒ ๋ณด๊ณ  ๋งŽ์ด ๋ฐฐ์› ์Šต๋‹ˆ๋‹ค๐Ÿ‘
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
์†กํ˜„๋‹˜, ์—ฌ๊ธฐ์„œ bind(this)๋ฅผ ์‚ฌ์šฉํ•˜์‹  ๊ฒƒ์€ ์–ด๋–ค ์˜๋ฏธ์ธ์ง€ ์—ฌ์ญค๋ด๋„ ๋ ๊นŒ์š”? ๊ผญ ํ•„์š”ํ•œ ์š”์†Œ์ธ์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๋„ค ๋งž์•„์š”. form ์ž์ฒด์— submit ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋ฉด ์ถ”ํ›„์— ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ์–ด์„œ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ ํ•จ์ˆ˜๋Š” ๋”ฐ๋กœ ๋นผ์ฃผ๋Š”๊ฒŒ ์ข‹์Šต๋‹ˆ๋‹ค.
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
์ €๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค! ํŽ‘์…˜ ์•ˆ์—์„œ this ์“ธ ๋•Œ, ๋ฐ”๊นฅ์˜ this ๋ฐ›์œผ๋ ค๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๊ฑธ๋กœ ์•Œ๊ณ  ์žˆ์—ˆ๋Š”๋ฐ this.setState ๋•Œ๋ฌธ์— ์‚ฌ์šฉํ•˜์‹ ๊ฑด๊ฐ€์š”?
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๋ฆฌ์•กํŠธ ํด๋ž˜์Šค ์ปดํฌ๋„ŒํŠธ์—์„œ bind๋ฅผ ์‚ฌ์šฉํ•˜์ง€ this๋Š” `undefined`๋กœ ์ธ์‹ํ•ด์š” ๊ทธ๋ž˜์„œ ์ด ๊ฒฝ์šฐ์— this๋ฅผ ์•Œ๋ ค์ค˜์•ผ ํ•˜๋Š”๋ฐ ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์–ด์š”. 1. ํƒœ๊ทธ ์ž์ฒด์—์„œ ์ด๋ฒคํŠธ๋ฅผ ํ™”์‚ดํ‘œ ํ•จ์ˆ˜๋กœ ์จ์ฃผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ex) `<input onChange={(e) => handleChange(e)} >` 2. ์ €๋Š” ์ฒซ ๋ฒˆ์งธ ๋ฐฉ์‹์ด ๊ฐ€๋…์„ฑ์ด ์ข‹์ง€ ์•Š์•„์„œ ์ฐจ๋ผ๋ฆฌ ๋ฆฌ์•กํŠธ ๋ฌธ์„œ์—์„œ ๊ถŒ์žฅํ•˜๋Š” ๋‘ ๋ฒˆ์งธ ๋ฐฉ์‹์œผ๋กœ [this๋ฅผ ์—ฐ๊ฒฐ](https://ko.reactjs.org/docs/handling-events.html)ํ–ˆ์Šต๋‹ˆ๋‹ค.
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๊ถ๊ธˆํ•ด์„œ ์งˆ๋ฌธ ๋‚จ๊น๋‹ˆ๋‹ค! [event.target.name]์€ ์œ„์— state ์„ ์–ธํ•  ๋•Œ ์—†๋Š”๋ฐ, input ํƒœ๊ทธ์— ์ด๋ฆ„์„ ์ฃผ๊ธฐ ์œ„ํ•œ๊ฑด๊ฐ€์š”? ๊ทธ๋ ‡๋‹ค๋ฉด, ํ˜น์‹œ ์ฒ˜์Œ render ํ• ๋•Œ๋Š” 'id'๋ฅผ ๋„ฃ๊ณ , ๊ฐ’ ๋ณ€๊ฒฝ๋ ๋•Œ ๊ฐ’์„ ์ด๋ฆ„์— ๋„ฃ์–ด์ฃผ์‹  ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
์˜†์ง‘์—์„œ ๊ตฌ๊ฒฝ์™”์Šต๋‹ˆ๋‹ค:)์ฝ”๋“œ๊ฐ€ ์ •๋ง ์„ฌ์„ธํ•˜์„ธ์š”!! ๋•๋ถ„์— bind, ์œ ํšจ์„ฑ ๊ฒ€์ฆ ๊ด€๋ จํ•ด์„œ ๋ฐฐ์šฐ๊ณ  ๊ฐ‘๋‹ˆ๋‹ค:)! ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค~
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
์†กํ˜„๋‹˜, ์ดํ•ดํ–ˆ์Šต๋‹ˆ๋‹ค! ์ €๋Š” bind๋ฅผ ํ•˜์ง€ ์•Š๊ณ ๋„ ์ž˜ ์‹คํ–‰๋˜์–ด์„œ ์˜์•„ํ–ˆ๋Š”๋ฐ, arrow function์„ ์‚ฌ์šฉํ–ˆ์—ˆ๋„ค์š”~! ๋งํฌ๊นŒ์ง€ ๊ฑธ์–ด์ฃผ์‹œ๋Š” ์ƒ์„ธํ•œ ์„ค๋ช…์— ๊ฐ๋™ํ–ˆ์Šต๋‹ˆ๋‹ค~ ใ… ใ… 
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๋งž์Šต๋‹ˆ๋‹ค. input ํƒœ๊ทธ์— name, value ์†์„ฑ์„ ์ด์šฉํ•ด์„œ onChange์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์›ํ•˜๋Š” ๊ณณ์— ๊ฐ’์„ ๋„ฃ์–ด์ฃผ๊ธฐ ์œ„ํ•ด์„œ ์ž…๋‹ˆ๋‹ค. ๋ฆฌ์•กํŠธ ์‚ฌ์ดํŠธ์—์„œ [๋‹ค์ค‘ ์ž…๋ ฅ ์ œ์–ดํ•˜๊ธฐ](https://ko.reactjs.org/docs/forms.htmll) ์ฝ์œผ์‹œ๋ฉด ๋„์›€ ๋˜์‹ค ๊ฑฐ ๊ฐ™๋„ค์š”!
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
this์— ๋Œ€ํ•ด์„œ ์ž˜ ๊ณ ๋ฏผํ•ด๋ณด์‹œ๊ณ  bind ๋ฉ”์†Œ๋“œ๊นŒ์ง€ ์ž˜ ์ฐพ์•„์„œ ์ ์šฉํ•ด์ฃผ์…จ๋„ค์š”! - ๋‹ค๋งŒ ์—ฌ๊ธฐ์„œ handleInput ํ•จ์ˆ˜๋Š” ์ด๋ฏธ arrow function์œผ๋กœ ์ž‘์„ฑ์„ ํ–ˆ๊ธฐ์— ๋‚ด๋ถ€์ ์œผ๋กœ this๋ฅผ ๊ฐ€์ง€์ง€์•Š๊ณ  ์ƒ์œ„ ์Šค์ฝ”ํ”„์˜ this๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ์— ํ•„์ˆ˜์ ์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค - ํ•จ์ˆ˜์„ ์–ธ + bind method๋กœ this๊ฐ€ ๋ฐ”์ธ๋”ฉ๋œ ์ƒˆ๋กœ์šด ํ•จ์ˆ˜ ์žฌ์ƒ์„ฑ ๋ณด๋‹ค๋Š” arrow function ์œผ๋กœ ํ•œ๋ฒˆ ์ž‘์„ฑํ•˜๋Š”๊ฒŒ ๊ฐ„ํŽธํ•˜๊ณ  ๊ฐ€๋…์„ฑ์ด ์ข‹๊ธฐ์— arrow function ์‚ฌ์šฉ์„ ๊ถŒ์žฅ๋“œ๋ฆฝ๋‹ˆ๋‹ค.
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๐Ÿ‘ ๊ตฌ์กฐ๋ถ„ํ•ดํ• ๋‹น๊นŒ์ง€ ํ•ด์ฃผ์‹œ๋ฉด ๋” ๊น”๋”ํ•˜๊ฒ ๋„ค์š” ``` const {name, value} = event; this.setState{{[name] : value}} ```
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
[๊ณต์‹๋ฌธ์„œ React๋กœ ์‚ฌ๊ณ ํ•˜๊ธฐ](https://ko.reactjs.org/docs/thinking-in-react.html#step-3-identify-the-minimal-but-complete-representation-of-ui-state) ๋ฅผ ๋ณด์‹œ๋ฉด ์–ด๋–ค ๊ฐ’๋“ค์ด state๊ฐ€ ๋˜์–ด์•ผํ•˜๋Š”์ง€์— ๋Œ€ํ•ด ์ ํ˜€์žˆ์Šต๋‹ˆ๋‹ค. > ๊ฐ๊ฐ ์‚ดํŽด๋ณด๊ณ  ์–ด๋–ค ๊ฒŒ state๊ฐ€ ๋˜์–ด์•ผ ํ•˜๋Š” ์ง€ ์‚ดํŽด๋ด…์‹œ๋‹ค. ์ด๋Š” ๊ฐ ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•ด ์•„๋ž˜์˜ ์„ธ ๊ฐ€์ง€ ์งˆ๋ฌธ์„ ํ†ตํ•ด ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค > 1. ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ props๋ฅผ ํ†ตํ•ด ์ „๋‹ฌ๋ฉ๋‹ˆ๊นŒ? ๊ทธ๋Ÿฌ๋ฉด ํ™•์‹คํžˆ state๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. > 2. ์‹œ...
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
- snake-case๋ฅผ ์ด์šฉํ•ด์„œ className ๋ถ€์—ฌํ•˜๊ณ  ๊ณ„์‹œ๊ตฐ์š”, nesting์„ ์œ„ํ•ด์„œ ์ตœ์ƒ์œ„ ํƒœ๊ทธ์— ๋ถ€์—ฌํ•˜๋Š” ํด๋ž˜์Šค๋„ค์ž„์€ ํด๋ ˆ์Šค๋„ค์ž„์˜ ์ค‘๋ณต์„ ํ”ผํ•˜๊ณ , ์ผ๋ฐ˜์ ์ธ ํด๋ž˜์Šค๋„ค์ž„๊ณผ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด์„œ PascalCase๋กœ ์ž‘์„ฑํ•ด์ฃผ๋Š”๊ฒƒ๋„ ์ข‹์•„๋ณด์ด๋„ค์š” - ์ด๋Ÿฐ ๋ถ€๋ถ„์€ ์ปจ๋ฒค์…˜์ ์ธ ๋ถ€๋ถ„์ด๊ธฐ์— ํŒ€๋ผ๋ฆฌ ํ•ฉ์˜ํ•ด์„œ ์ง„ํ–‰ํ•ด์ฃผ์‹œ๋ฉด ๋˜์ง€๋งŒ ์œ„์ฝ”๋“œ๋‚ด์—์„œ๋Š” ์ปดํฌ๋„ŒํŠธ ์ด๋ฆ„๊ณผ ๋™์ผํ•˜๊ฒŒ PascalCase๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๊ฒƒ์„ ๊ถŒ์žฅํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค(๊ถŒ์žฅ์ผ ๋ฟ ํ•„์ˆ˜๋Š” ์•„๋‹ˆ๊ธฐ์— ์ปจ๋ฒค์…˜์€ ํŒ€์›๋ผ๋ฆฌ ํ•ฉ์˜ํ•ด์„œ ์ ์šฉํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.)
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
autoComplete, aria-label ๋“ฑ์˜ ์†์„ฑ๊นŒ์ง€ ์„ธ์‹ฌํ•˜๊ฒŒ ์‹ ๊ฒฝ์“ฐ์…จ๋„ค์š”๐Ÿ‘
@@ -0,0 +1,78 @@ +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + border: 1px solid #bdbdbd; + text-align: center; + background: rgb(250, 250, 250); + + .login-container { + width: 350px; + height: 350px; + padding: 0 40px; + border: 1px solid silver; +...
Unknown
์ด๋ ‡๊ฒŒ ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ๋ฐ˜๋ณต๋˜๋Š” ์†์„ฑ์€ mixin ํ˜•ํƒœ๋กœ ๋งŒ๋“ค์–ด์„œ ์‚ฌ์šฉํ•˜๋Š”๊ฒƒ๋„ ์ข‹์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,78 @@ +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + border: 1px solid #bdbdbd; + text-align: center; + background: rgb(250, 250, 250); + + .login-container { + width: 350px; + height: 350px; + padding: 0 40px; + border: 1px solid silver; +...
Unknown
css ์†์„ฑ ์ˆœ์„œ ๊ฐ€์ด๋“œ๋ผ์ธ์— ๋งž์ถฐ์ฃผ์„ธ์š”
@@ -0,0 +1,78 @@ +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + border: 1px solid #bdbdbd; + text-align: center; + background: rgb(250, 250, 250); + + .login-container { + width: 350px; + height: 350px; + padding: 0 40px; + border: 1px solid silver; +...
Unknown
style์„ ๋ถ€์—ฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ์—๋Š” ๊ตณ์ด className ๋ถ€์—ฌ ๋ฐ ๋„ค์ŠคํŒ… ํ•  ํ•„์š” ์—†์Šต๋‹ˆ๋‹ค!
@@ -0,0 +1,78 @@ +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + border: 1px solid #bdbdbd; + text-align: center; + background: rgb(250, 250, 250); + + .login-container { + width: 350px; + height: 350px; + padding: 0 40px; + border: 1px solid silver; +...
Unknown
์—ฌ๊ธฐ์„œ ๋ถ€์—ฌํ•˜๊ณ  ์žˆ์—ˆ๋„ค์š” ํ•ด๋‹น ์…€๋ ‰ํ„ฐ์˜ ์Šคํƒ€์ผ์€ ์…€๋ ‰ํ„ฐ ๋ฐ”๋กœ ํ•˜์œ„์— ์ ์–ด์ฃผ์„ธ์š” ์ด๋ ‡๊ฒŒ ๋„ค์ŠคํŒ…์ด ์ญ‰ ์žˆ๊ณ  ๊ทธ ๋’ค์— ์žˆ์œผ๋ฉด ๊ฐ€๋…์„ฑ์ธก๋ฉด์—์„œ ์ข‹์ง€์•Š์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,78 @@ +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + border: 1px solid #bdbdbd; + text-align: center; + background: rgb(250, 250, 250); + + .login-container { + width: 350px; + height: 350px; + padding: 0 40px; + border: 1px solid silver; +...
Unknown
scss์˜ extends ๋ฌธ๋ฒ• ํ™œ์šฉํ•˜๋ฉด ์ข‹๊ฒ ๋„ค์š”
@@ -0,0 +1,78 @@ +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + border: 1px solid #bdbdbd; + text-align: center; + background: rgb(250, 250, 250); + + .login-container { + width: 350px; + height: 350px; + padding: 0 40px; + border: 1px solid silver; +...
Unknown
๋ถˆํ•„์š”ํ•œ ์ฃผ์„์€ ์‚ญ์ œํ•ด์ฃผ์„ธ์š”
@@ -0,0 +1,19 @@ +import React, { Component } from 'react'; + +class Comment extends Component { + render() { + const { profile, name, content } = this.props; + return ( + <li className="feeds-comment__reply"> + <div className="user-feeds__profile--img"> + <img src={profile} alt="ํ”ผ๋“œ์‚ฌ์ง„" /> + ...
JavaScript
```suggestion {!this.props.profile && ( <img src={this.props.profile} alt="ํ”ผ๋“œ์‚ฌ์ง„" /> ) ``` - !== ์—ฐ์‚ฐ์ž ๋ถˆํ•„์š”ํ•ด๋ณด์ž…๋‹ˆ๋‹ค, ๋นˆ ๋ฌธ์ž์—ด์€ falsy ๊ฐ’์ด๊ธฐ์— not ์—ฐ์‚ฐ์ž์™€ ์กฐํ•ฉํ•ด์„œ ๋นˆ๋ฌธ์ž์—ด์ด ์•„๋‹๋•Œ๋ฅผ ํ‘œํ˜„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. - true์ผ ๊ฒฝ์šฐ์—๋งŒ ๋ Œ๋”๋ง๋˜๋ฉด ๋œ๋‹ค๋ฉด ์‚ผํ•ญ์—ฐ์‚ฐ์ž๋ง๊ณ  && ์—ฐ์‚ฐ์ž๋ฅผ ์ด์šฉํ•ด๋ณด์„ธ์š”
@@ -0,0 +1,19 @@ +import React, { Component } from 'react'; + +class Comment extends Component { + render() { + const { profile, name, content } = this.props; + return ( + <li className="feeds-comment__reply"> + <div className="user-feeds__profile--img"> + <img src={profile} alt="ํ”ผ๋“œ์‚ฌ์ง„" /> + ...
JavaScript
props ๊ตฌ์กฐ๋ถ„ํ•ดํ• ๋‹นํ•ด์„œ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹์•„๋ณด์ด๋„ค์š”
@@ -0,0 +1,43 @@ +import React, { Component } from 'react'; +import Comment from './Comment/Comment'; +import './CommentList.scss'; + +class CommentList extends Component { + constructor(props) { + super(props); + this.state = { + commentList: [], + }; + } + componentDidMount() { + fetch('http://loc...
JavaScript
data๋ผ๋Š” ๊ด‘๋ฒ”์œ„ํ•œ ๋ณ€์ˆ˜๋ช…๋ณด๋‹ค๋Š” ์˜๋ฏธ๊ฐ€ ๋“œ๋Ÿฌ๋‚˜๊ฒŒ ๋ณ€์ˆ˜๋ช… ์ง€์–ด์ฃผ์„ธ์š”
@@ -1,7 +1,246 @@ -import React from 'react'; +import React, { Component } from 'react'; +import CommentList from './CommentList/CommentList'; +import IconList from './IconList/IconList'; +import userImg from '../../../assets/images/IMG_2625.jpg'; +import feedImg from '../../../assets/images/feed.jpg'; +import './Main....
JavaScript
์ด๋ ‡๊ฒŒ ๋ฐ˜๋ณต๋˜๋Š” UI๋Š” Array.map์„ ํ™œ์šฉํ•ด์„œ ํ‘œํ˜„ํ•ด๋ณด์„ธ์š” ์ •์ ์ธ ์ปจํ…์ธ ๋ผ๋ฉด ์ƒ์ˆ˜๋ฐ์ดํ„ฐ์™€ ์กฐํ•ฉํ•˜๋ฉด ํ‘œํ˜„ ๊ฐ€๋Šฅํ•ด๋ณด์ž…๋‹ˆ๋‹ค.
@@ -1,7 +1,246 @@ -import React from 'react'; +import React, { Component } from 'react'; +import CommentList from './CommentList/CommentList'; +import IconList from './IconList/IconList'; +import userImg from '../../../assets/images/IMG_2625.jpg'; +import feedImg from '../../../assets/images/feed.jpg'; +import './Main....
JavaScript
์ด ํŒŒ์ผ์—์„œ ๋ฐ˜๋ณต๋˜๋Š” UI ๋งŽ์ด ๋ณด์ด๋Š”๋ฐ ๋‹ค ํ•œ๋ฒˆ Array.map์„ ์ด์šฉํ•ด์„œ ํ‘œํ˜„ํ•ด๋ณด์„ธ์š”
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๋„ค ์ฝ”๋“œ ๋ฆฌ๋ทฐ ์ ์šฉํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
@@ -1,7 +1,77 @@ -import React from 'react'; +import React, { Component } from 'react'; +import './Login.scss'; -function Login() { - return <div>Nav bar</div>; +class Login extends Component { + constructor(props) { + super(props); + this.state = { + id: '', + pwd: '', + }; + } + + handleInput...
JavaScript
๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž
@@ -5,16 +5,18 @@ export default class ReviewMapper { constructor(private readonly review: ReviewAllProperties) {} toDomain() { + if (!this.review) return null; + return new Review({ id: this.review.id, - writerId: this.review.writerId, - writer: this.review.writer, - ownerId: this...
TypeScript
์ €๋„ ์ด๋ ‡๊ฒŒ ํ–ˆ๋Š”๊ฑฐ ๊ฐ™๊ธด ํ•œ๋ฐ if๋ฌธ ์•ˆ์—์„œ null ๊ฐ’๊ณผ undefined๊ฐ’์„ ์ฒดํฌํ•ด์„œ ๋ฆฌํ„ด๋ฌธ ์ดํ›„๋กœ ์˜ต์…”๋„๋กœ ์ค„ ํ•„์š”๋Š” ์—†๋Š”๊ฑฐ ๊ฐ™์•„์š”
@@ -1,4 +1,5 @@ import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator'; +import { Type } from 'class-transformer'; export class CreateReviewDTO { @IsUUID() @@ -18,3 +19,13 @@ export class CreateReviewDTO { @IsNotEmpty() planId: string; } + +export class GetReviewsQueryDTO { + @...
TypeScript
๊ธฐ๋ณธ๊ฐ’์„ ์ฃผ๋ ค๋ฉด isOptional์ด ์žˆ์–ด์•ผ๋˜์ง€ ์•Š๋‚˜์š”? ํ…Œ์ŠคํŠธํ•ด์„œ ๊ดœ์ฐฎ๋˜๊ฐ€์š”?
@@ -14,13 +14,13 @@ export interface ReviewProperties { export interface ReviewAllProperties { id?: string; - writerId: string; + writerId?: string; writer?: UserReference; - ownerId: string; + ownerId?: string; owner?: UserReference; rating: number; content: string; - planId: string; + planId?:...
TypeScript
ํ”Œ๋žœ์ด ์‚ญ์ œ๋˜๋”๋ผ๋„ ๋ฆฌ๋ทฐ๋Š” ๋‚จ์•„์žˆ๋Š” ํ”„๋กœ์„ธ์Šค์ธ๊ฐ€์š”? ๊ทธ๋ ‡๋‹ค๋Š” ์ „์ œํ•˜์— ์ €ํฌ๋Š” ๋…ผ๋ฆฌ์‚ญ์ œ๋ผ์„œ planId๋Š” ์˜ต์…”๋„์ด ์•„๋‹ˆ์—ฌ๋„ ๋ ๊ฑฐ๊ฐ™์•„์š”. ํ”Œ๋žœ์€ ์˜ต์…”๋„๋กœ ์œ ์ง€ํ•ด์•ผ๊ฒ ๋„ค์š”. ์—ฌ๊ธฐ createdAt๊ณผ updatedAt์ด ์˜ต์…”๋„์ด ์•„๋‹ˆ์—ฌ๋„ ๊ดœ์ฐฎ์ง€ ์•Š๋‚˜์š”?
@@ -5,16 +5,18 @@ export default class ReviewMapper { constructor(private readonly review: ReviewAllProperties) {} toDomain() { + if (!this.review) return null; + return new Review({ id: this.review.id, - writerId: this.review.writerId, - writer: this.review.writer, - ownerId: this...
TypeScript
๋ฆฌํ„ด๋ฌธ์— ์˜ต์…”๋„์„ ์•ˆ ๋„ฃ์œผ๋ฉด, ์˜ˆ๋ฅผ ๋“ค๋ฉด ์ง€๊ธˆ PR์— ์˜ฌ๋ฆฐ ๋ฆฌ๋ทฐ ๋ชฉ๋ก ์กฐํšŒ ๋•Œ๋Š” writer ๋ฐ์ดํ„ฐ๋Š” include๋ฅผ ํ•˜์ง€ ์•Š๊ณ  ๋งคํ•‘ํ•˜๋‹ˆ๊นŒ ๊ฐ’์ด ์—†๋Š”๋ฐ ๋ฌธ์ œ ์—†๋‚˜์š”???
@@ -1,4 +1,5 @@ import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator'; +import { Type } from 'class-transformer'; export class CreateReviewDTO { @IsUUID() @@ -18,3 +19,13 @@ export class CreateReviewDTO { @IsNotEmpty() planId: string; } + +export class GetReviewsQueryDTO { + @...
TypeScript
๋„ค ๋‹ค์‹œ ํ…Œ์ŠคํŠธํ•ด๋ดค๋Š”๋ฐ ๋ฌธ์ œ ์—†์–ด์š”! ์ € ์ฐธ๊ณ ๋กœ PlanQueryOptionDTO ์ฐธ๊ณ ํ•ด์„œ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Žใ…Ž
@@ -14,13 +14,13 @@ export interface ReviewProperties { export interface ReviewAllProperties { id?: string; - writerId: string; + writerId?: string; writer?: UserReference; - ownerId: string; + ownerId?: string; owner?: UserReference; rating: number; content: string; - planId: string; + planId?:...
TypeScript
์‚ฌ์‹ค ์ด ์ธํ„ฐํŽ˜์ด์Šค๋Š” ์‹ค์ œ ํ”„๋กœ์„ธ์Šค์—์„œ ๋ฆฌ๋ทฐ ๊ฐ์ฒด๋ฅผ ์ด๋ฃจ๋Š” ๋ฐ์— ํ•„์š”ํ•œ ํ•„๋“œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋งŒ๋“ค์–ด์„œ rating, content ๋ง๊ณ ๋Š” ๋‹ค ์˜ต์…”๋„์ž…๋‹ˆ๋‹ค.. ์˜ˆ๋ฅผ ๋“ค๋ฉด ์ง€๊ธˆ ๋งŒ๋“  API์˜ ๊ฒฝ์šฐ plan์— ๋Œ€ํ•œ ๋‚ด์šฉ์ด ํ•„์š”์—†๊ธฐ ๋•Œ๋ฌธ์— planId๋ฅผ db์—์„œ ๊ฐ€์ ธ์˜ค์ง€๋„ ์•Š๊ฑฐ๋“ ์š”. ์ด์ œ ๋งŒ๋“ค๊ฒŒ ๋  dreamer์˜ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ๋ฆฌ๋ทฐ ๋ชฉ๋ก์—๋Š” ํ•„์š”ํ•˜๊ณ ์š”. ์˜ต์…”๋„์ด ๋„ˆ๋ฌด ๋งŽ์•„์„œ ํƒ€์ž… ์•ˆ์ •์„ฑ์ด ์ข€ ์• ๋งคํ•˜๋‹ค๋ฉด ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์•„์˜ˆ ๋‚˜๋ˆ„๊ฑฐ๋‚˜ ํ•ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
@@ -5,16 +5,18 @@ export default class ReviewMapper { constructor(private readonly review: ReviewAllProperties) {} toDomain() { + if (!this.review) return null; + return new Review({ id: this.review.id, - writerId: this.review.writerId, - writer: this.review.writer, - ownerId: this...
TypeScript
์ € ์˜ต์…”๋„์€ review๊ฐ€ ์žˆ๋Š”์ง€ ์ฒดํฌํ•˜๋Š”๊ฑฐ์ง€ ์•Š๋‚˜์š”?
@@ -1,4 +1,5 @@ import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator'; +import { Type } from 'class-transformer'; export class CreateReviewDTO { @IsUUID() @@ -18,3 +19,13 @@ export class CreateReviewDTO { @IsNotEmpty() planId: string; } + +export class GetReviewsQueryDTO { + @...
TypeScript
๊ทธ๋ ‡๊ตฐ์š”,,
@@ -14,13 +14,13 @@ export interface ReviewProperties { export interface ReviewAllProperties { id?: string; - writerId: string; + writerId?: string; writer?: UserReference; - ownerId: string; + ownerId?: string; owner?: UserReference; rating: number; content: string; - planId: string; + planId?:...
TypeScript
์ดํ•ดํ–ˆ์Šต๋‹ˆ๋‹ค
@@ -14,13 +14,13 @@ export interface ReviewProperties { export interface ReviewAllProperties { id?: string; - writerId: string; + writerId?: string; writer?: UserReference; - ownerId: string; + ownerId?: string; owner?: UserReference; rating: number; content: string; - planId: string; + planId?:...
TypeScript
๋‚˜๋ˆ„๊ธฐ๋ณด๋‹จ ๊ทธ๋ƒฅ ์˜ต์…”๋„๋กœ ํƒ€์ž…๊ฐœ์ˆ˜๋ฅผ ์ค„์ด์ฃ 
@@ -5,16 +5,18 @@ export default class ReviewMapper { constructor(private readonly review: ReviewAllProperties) {} toDomain() { + if (!this.review) return null; + return new Review({ id: this.review.id, - writerId: this.review.writerId, - writer: this.review.writer, - ownerId: this...
TypeScript
this.review์— ํ•ด๋‹น ๊ฐ’์ด ์—†์œผ๋ฉด undefined ๊ฐ’์„ ํ• ๋‹นํ•œ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค (ํ˜น์‹œ๋‚˜ ํ•ด์„œ ๋‹ค์‹œ ์ฐพ์•„๋ดค์Šต๋‹ˆ๋‹ค ใ…Žใ…Žใ…Ž)
@@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".ArchiveReviewFragment" > + + ...
Unknown
์—ฌ๊ธฐ์˜ ์ปจํ…์ŠคํŠธ๋Š” .ArchiveReviewFragment๋กœ ์ถ”์ •๋ฉ๋‹ˆ๋‹ค.
@@ -0,0 +1,22 @@ +package common; + +import domain.gameresult.GameResult; +import domain.gameresult.GameResults; +import domain.player.Player; +import domain.player.Players; + +import java.util.HashMap; +import java.util.Map; + +public class PlayerGameResult { + public static Map<String, String> match(Players player...
Java
์ด ํด๋ž˜์Šค๊ฐ€ ๊ผญ ํ•„์š”ํ• ๊นŒ์š”? common ํŒจํ‚ค์ง€์— ์œ„์น˜ํ•œ ์ด์œ ์™€ ๊ฐ ์ฑ…์ž„์„ ๋‹ค๋ฅธ ํด๋ž˜์Šค๋“ค๋กœ ์œ„์ž„ํ•  ์ˆ˜ ์—†์„์ง€ ๊ณ ๋ฏผํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,22 @@ +package common; + +import domain.gameresult.GameResult; +import domain.gameresult.GameResults; +import domain.player.Player; +import domain.player.Players; + +import java.util.HashMap; +import java.util.Map; + +public class PlayerGameResult { + public static Map<String, String> match(Players player...
Java
command + , java code style method chaining multi line ๋ถ€๋ถ„์— ์ฒดํฌํ•˜๊ณ  ์ •๋ ฌํ•˜์‹œ๋ฉด ๊ฐ€๋…์„ฑ ์ข‹๊ฒŒ ์ •๋ ฌ๋ฉ๋‹ˆ๋‹ค ~ ์ถ”์ฒœ๋“œ๋ ค์š”
@@ -0,0 +1,22 @@ +package common; + +import domain.gameresult.GameResult; +import domain.gameresult.GameResults; +import domain.player.Player; +import domain.player.Players; + +import java.util.HashMap; +import java.util.Map; + +public class PlayerGameResult { + public static Map<String, String> match(Players player...
Java
get ์œผ๋กœ ๊ฐ€์ ธ์™€์„œ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค Tell don't ask ์›์น™์„ ์ ์šฉํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”?
@@ -0,0 +1,106 @@ +package controller; + +import common.PlayerGameResult; +import domain.gameresult.GameResultFactory; +import domain.gameresult.GameResultName; +import domain.gameresult.GameResults; +import domain.ladder.Height; +import domain.ladder.Ladder; +import domain.ladder.LadderGenerator; +import domain.player...
Java
์ƒํƒœ๊ฐ’์ด ์กด์žฌํ•˜์ง€ ์•Š๋„๋ก ๊ตฌํ˜„ํ•ด์„œ static ํ•˜๊ฒŒ ์‚ฌ์šฉํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,106 @@ +package controller; + +import common.PlayerGameResult; +import domain.gameresult.GameResultFactory; +import domain.gameresult.GameResultName; +import domain.gameresult.GameResults; +import domain.ladder.Height; +import domain.ladder.Ladder; +import domain.ladder.LadderGenerator; +import domain.player...
Java
Players ๊ฐ€ ์•„๋‹Œ Factory ํด๋ž˜์Šค๋ฅผ ๋„์ž…ํ–ˆ์„ ๋•Œ ์–ด๋–ค ์žฅ์ ์ด ์žˆ์„๊นŒ์š”?
@@ -0,0 +1,106 @@ +package controller; + +import common.PlayerGameResult; +import domain.gameresult.GameResultFactory; +import domain.gameresult.GameResultName; +import domain.gameresult.GameResults; +import domain.ladder.Height; +import domain.ladder.Ladder; +import domain.ladder.LadderGenerator; +import domain.player...
Java
controller ์—์„œ input ์„ ๋ฐ›๋Š”๊ฒŒ ์•„๋‹ˆ๋ฏ€๋กœ ๋ฉ”์„œ๋“œ๋ช…์„ ๋ฐ”๊ฟ”๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”? ์‹ฌํ”Œํ•˜๊ฒŒ getGameResultNames() ๋Š” ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,106 @@ +package controller; + +import common.PlayerGameResult; +import domain.gameresult.GameResultFactory; +import domain.gameresult.GameResultName; +import domain.gameresult.GameResults; +import domain.ladder.Height; +import domain.ladder.Ladder; +import domain.ladder.LadderGenerator; +import domain.player...
Java
null ๋กœ ํ• ๋‹นํ•˜๋Š” ๊ฒƒ๊ณผ ArrayList ๋กœ ํ• ๋‹นํ•˜๋Š” ๊ฒƒ ์ค‘ ์–ด๋А๊ฒŒ ๋” ํšจ์œจ์ ์ผ๊นŒ์š”
@@ -0,0 +1,106 @@ +package controller; + +import common.PlayerGameResult; +import domain.gameresult.GameResultFactory; +import domain.gameresult.GameResultName; +import domain.gameresult.GameResults; +import domain.ladder.Height; +import domain.ladder.Ladder; +import domain.ladder.LadderGenerator; +import domain.player...
Java
Ladder ์˜ ์ƒ์„ฑ์ž๋ฅผ ํ†ตํ•ด ์ƒ์„ฑํ•˜์ง€ ์•Š๊ณ  Generator ๋ฅผ ํ†ตํ•ด ์ƒ์„ฑํ•˜๋ฉด ์–ด๋–ค ์žฅ์ ์ด ์žˆ์„๊นŒ์š”
@@ -0,0 +1,46 @@ +package domain.player; + +import domain.line.Line; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Players { + + private List<Player> players; + + public Players(List<Player> players) { + this.playe...
Java
getPlayerNames ๋Š” ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,46 @@ +package domain.player; + +import domain.line.Line; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Players { + + private List<Player> players; + + public Players(List<Player> players) { + this.playe...
Java
player.getPositionX(); ๋กœ ๋””๋ฏธํ„ฐ๋ฒ•์น™์„ ์ง€์ผœ๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,32 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Line { + private List<Point> points; + + public Line(List<Point> points) {...
Java
getDirectionFlags() ๋Š” ์–ด๋–ค๊ฐ€์š”?
@@ -0,0 +1,28 @@ +package domain.gameresult; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class GameResults { + private List<GameResult> gameResults; + + public GameResults(List<GameResult> gameResults) { + this.gameRes...
Java
๊ฐ์ฒด์˜ ์ƒํƒœ๋ฅผ ๋ณ€ํ™˜ํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๊ณ  ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ์ด๋ฏ€๋กœ get ์ด๋ผ๋Š” ๋™์‚ฌ์–ด๊ฐ€ ์–ด์šธ๋ฆด ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค
@@ -0,0 +1,106 @@ +package controller; + +import common.PlayerGameResult; +import domain.gameresult.GameResultFactory; +import domain.gameresult.GameResultName; +import domain.gameresult.GameResults; +import domain.ladder.Height; +import domain.ladder.Ladder; +import domain.ladder.LadderGenerator; +import domain.player...
Java
Collection ํ”„๋ ˆ์ž„์›Œํฌ ๋„ค์ด๋ฐ์„ ์ฐธ๊ณ ํ•ด๋ณด๋ฉด players.contains(playerName) ์ด ๋” ์ž์—ฐ์Šค๋Ÿฝ์ง€ ์•Š์„๊นŒ์š”~?
@@ -0,0 +1,32 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Line { + private List<Point> points; + + public Line(List<Point> points) {...
Java
this.points = points ๋กœ ํ•˜๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ์š”?
@@ -0,0 +1,32 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Line { + private List<Point> points; + + public Line(List<Point> points) {...
Java
unmodifiable ๋กœ ํ•œ๋ฒˆ ๊ฐ์‹ผ ์ด์œ ๊ฐ€ ์žˆ์œผ์‹ค๊นŒ์š”?
@@ -0,0 +1,32 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Line { + private List<Point> points; + + public Line(List<Point> points) {...
Java
array out of index ์—๋Ÿฌ๋Š” ๊ฑฑ์ •ํ•˜์ง€ ์•Š์•„๋„ ๋˜๋Š”๊ฑด๊ฐ€์š”?
@@ -0,0 +1,32 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Line { + private List<Point> points; + + public Line(List<Point> points) {...
Java
find ์™€ get ๋ฉ”์„œ๋“œ ๋„ค์ด๋ฐ์˜ ์ฐจ์ด๊ฐ€ ๋ฌด์—‡์ผ๊นŒ์š”?
@@ -0,0 +1,32 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Line { + private List<Point> points; + + public Line(List<Point> points) {...
Java
points ๋ฅผ Line ์œผ๋กœ ์ถ”์ƒํ™”ํ•˜์‹  ๊ฒƒ ๊ฐ™์€๋ฐ getPoints() ๊ฐ€ ํ•„์š”ํ•œ ์ผ€์ด์Šค๊ฐ€ ์žˆ์„๊นŒ์š”?
@@ -0,0 +1,21 @@ +package domain.gameresult; + +import domain.player.Position; + +public class GameResult { + private GameResultName name; + private Position position; + + public GameResult(GameResultName name, Position position) { + this.name = name; + this.position = position; + } + + pub...
Java
์ƒ์„ฑ์ž์™€ getter ๋ฟ์ธ๋ฐ ์ด๊ฑด DTO ์—ญํ• ์ธ๊ฐ€์š”?
@@ -0,0 +1,17 @@ +package domain.gameresult; + +import domain.player.Position; + +import java.util.ArrayList; +import java.util.List; + +public class GameResultFactory { + + public static GameResults from(List<GameResultName> gameResultNames, int positionY) { + List<GameResult> gameResults = new ArrayList<>()...
Java
์ƒ์„ฑ์„ Factory ๋กœ ๋ชจ๋‘ ์œ„์ž„ํ•œ ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค. Factory ์—†์ด ๋„๋ฉ”์ธ ํด๋ž˜์Šค์˜ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๋ฅผ ํ†ตํ•ด ์ƒ์„ฑํ•˜๋ฉด ์–ด๋–ค ์•ˆ ์ข‹์€ ์ ์ด ์žˆ์„๊นŒ์š”? ๊ทธ๋ฆฌ๊ณ  GameResultsFactory ๊ฐ€ ์•„๋‹๊นŒ์š”?
@@ -0,0 +1,21 @@ +package domain.ladder; + +public class Height { + private static final String INPUT_POSITIVE_MESSAGE = "[ERROR] ๋†’์ด๋Š” 0 ์ดˆ๊ณผ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค."; + private int height; + + public Height(int height) { + validatePositive(height); + this.height = height; + } + + public void validatePositive...
Java
private ์ด์–ด์•ผ ํ•˜์ง€ ์•Š์„๊นŒ์š”~?
@@ -0,0 +1,18 @@ +package domain.ladder; + +import domain.line.Line; +import domain.line.LineGenerator; + +import java.util.ArrayList; +import java.util.List; + +public class LadderGenerator { + + public static Ladder generate(int ladderHeight, int playerCount) { + List<Line> lines = new ArrayList<>(); + ...
Java
Ladder ๋กœ ์œ„์ž„ํ•˜๋ฉด ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,49 @@ +package domain.line; + +import domain.point.Point; +import domain.point.RandomPointGenerator; + +import java.util.ArrayList; +import java.util.List; + +public class LineGenerator { + + public static Line generate(int playerCount) { + List<Point> points = new ArrayList<>(); + if (playe...
Java
Line ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ Point, List<Point> ํƒ€์ž…๊นŒ์ง€ ์ƒ์„ฑํ•˜๊ณ  ์žˆ๋Š”๋ฐ ๊ฐ์ž ์œ„์ž„๋ ๋งŒํ•œ ๋„๋ฉ”์ธ ํด๋ž˜์Šค๊ฐ€ ์žˆ์ง€ ์•Š์„๊นŒ์š”? ํ•œ๋ฒˆ ๊ณ ๋ฏผํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,35 @@ +package domain.player; + +import domain.point.Direction; + +public class Player { + private Name name; + private Position position; + + public Player(Name name, Position position) { + this.name = name; + this.position = position; + } + + public void move(Direction directio...
Java
์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ™œ์šฉํ•ด์„œ if ๋ฌธ์„ ์—†์•จ ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ์š”?
@@ -0,0 +1,46 @@ +package domain.player; + +import domain.line.Line; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Players { + + private List<Player> players; + + public Players(List<Player> players) { + this.playe...
Java
์ด ๋ฉ”์„œ๋“œ๋Š” ์–ด๋””์„œ ์‚ฌ์šฉ๋˜๋Š”๊ฑด๊ฐ€์š”~?
@@ -0,0 +1,54 @@ +package domain.player; + +import java.util.Objects; + +public class Position { + private static final String NEGATIVE_ERROR_MESSAGE = "[ERROR] Position์˜ x, y ๊ฐ’์€ ์–‘์ˆ˜์ž…๋‹ˆ๋‹ค."; + private int x; + private int y; + + public Position(int x, int y) { + validateNegative(x, y); + this.x =...
Java
equals ์™€ hashcode ๋ฅผ ์žฌ์ •์˜ํ•œ ์ด์œ ๋ฅผ ์„ค๋ช…ํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”~
@@ -0,0 +1,65 @@ +package domain.point; + +public class Point { + private static final String CONTINUOUS_CONNECTION_BRIDGE_ERROR_MESSAGE = "[ERROR] ๋‹ค๋ฆฌ๋Š” ์—ฐ์†๋˜์–ด ์กด์žฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."; + + private boolean left; + private boolean right; + private Direction direction; + + public Point(boolean left, boolean right) { + ...
Java
check ๋ผ๋Š” ๋ฉ”์„œ๋“œ๋Š” Direction ์„ ๋ฐ˜ํ™˜ํ•˜๊ธฐ์— ์ ์ ˆํ•˜์ง€ ์•Š์€ ๋ฉ”์„œ๋“œ๋ช…์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. getConnectedDirection() ์€ ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,12 @@ +package domain.point; + +import java.util.Random; + +public class RandomPointGenerator { + + private static Random random = new Random(); + + public static boolean generate() { + return random.nextBoolean(); + } +}
Java
์—ญํ• ์€ Random ์„ ๊ฐ์‹ผ wrapper ํด๋ž˜์Šค์ธ๋ฐ Point ๋ผ๋Š” ์ œํ•œ์„ ์ด๋ฆ„์œผ๋กœ ์ฃผ๊ฒŒ ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. RandomGenerator util ๋กœ ๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”
@@ -0,0 +1,80 @@ +package domain.line; + +import domain.point.Direction; +import domain.point.Point; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +class LineTest { + + ...
Java
good ํ…Œ์ŠคํŠธ ์ž˜ ์ž‘์„ฑํ•˜์…จ๋„ค์š”