Skip to content

Conversation

@SangHyeonKwon
Copy link

Screenshot 2025-05-18 at 1 54 08 AM

스크린샷입니다!

@SangHyeonKwon
Copy link
Author

시간을 현시간 기준 12시간인지, 0시부터 12시간인지 몰라서 우선은 0시 시작으로 해놓았습니다

@dwkim0101
Copy link

프사가 너무 웃겨요 ..

@SangHyeonKwon
Copy link
Author

감사합니다 하하

Copy link

@greetings1012 greetings1012 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 코드를 잘 작성해주셔서 이전보다 리뷰 달 내용이 많지 않네요!
몇 개 생각할 거리를 적어 놨으니, 확인 후 Reply 부탁드립니다!

const CurrentWeather = ({ weatherData, isLoading }) => {
if (isLoading) {
return <div>채워주세요</div>;
return <div>Loading...</div>;

Choose a reason for hiding this comment

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

Loading 대신 스피너나 간단한 스켈레톤 UI를 추가해보는 것도 좋을 것 같아요!

https://blog.makerjun.com/2f7a9818-df45-4eab-9768-b79d61b4d0ec

Copy link
Author

Choose a reason for hiding this comment

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

네 보내주신 링크 확인해봤는데 유저입장에서 생각해보면 글로 대충 Loading... 써있으면 저라도 도중에 웹사이트 나갔을 것 같습니다.
사소하지만 중요한 부분인 것 같아요! 바꿔볼게요

Comment on lines +26 to +41
<div>
<DailyForecastWrapper>
{dailyData.map((item, index) => (
<>
<DailyItem key={index}>
<div>{splitTime(item.time)}</div>
<div>{getWeatherDescription(item.code)}</div>
<div>
{Math.round(item.temperature)}
{degree}
</div>
</DailyItem>
</>
))}
</DailyForecastWrapper>
</div>

Choose a reason for hiding this comment

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

가장 바깥 div는 어떤 역할인가요?

Copy link
Author

Choose a reason for hiding this comment

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

크게 신경 안 썼던 부분이었습니다. 가독성을 낮추는 요소라고 분명히 생각들지만, 다른 문제점이 혹시 있을지 여쭤봅니다..

Comment on lines +3 to +8
export const GlobalStyle = createGlobalStyle`
html, body {
margin: 0;
padding: 0;
}
`;

Choose a reason for hiding this comment

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

GlobalStyle은 어떤 이유에서 쓰인 걸까요?

Copy link
Author

Choose a reason for hiding this comment

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

크롬 default 스타일 살짝의 여백을 없애려고 검색 후 한 스타일링 입니다
혹시 더 좋은 방법이 있다면 알려주시면 감사하겠습니다

Comment on lines +31 to +37
<CurrentWeather weatherData={weatherData} isLoading={isLoading} />
{!isLoading && weatherData && (
<>
<HourlyForecast weatherData={weatherData} />
<DailyForecast weatherData={weatherData} />
</>
)}

Choose a reason for hiding this comment

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

이 세 가지 컴포넌트가 모두 같은 props를 전달받고 있어요!
다시 말하면, 세 컴포넌트는 생긴 모양은 전부 다르지만 필요한 데이터의 형식은 같다고 말할 수 있겠네요.
weatherData와 type를 받아 type에 따라 data를 필요한 형태로 가공하는 hook(util) 함수를 만들고, 이를 각 컴포넌트에서 불러와 스타일만 다르게 적용시키는 방식을 사용하면 코드가 훨씬 깔끔해질 것 같아요!

Comment on lines +12 to +23
const splitTime = (timeString) => {
if (!timeString) return "time Error";

const date = new Date(timeString);
const days = ["일", "월", "화", "수", "목", "금", "토"];
const dayOfWeek = days[date.getDay()];

const month = date.getMonth() + 1;
const day = date.getDate();

return `${month}${day}일 (${dayOfWeek})`;
};

Choose a reason for hiding this comment

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

util에 포매팅 함수를 정의하는 파일을 만들어 정리해두면 좋을 것 같아요!

Copy link
Author

Choose a reason for hiding this comment

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

참고하겠습니다!

Comment on lines +46 to +48
time: dailyData.time[i], // 얘도 슬라이싱
temperature: dailyData.temperature_2m_max[i],
code: dailyData.weather_code[i],

Choose a reason for hiding this comment

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

여기도 포매팅 함수인데, 이것도 분리해볼까요?

Copy link
Author

Choose a reason for hiding this comment

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

여기도 참고하겠습니다

Comment on lines +29 to +32
time: weatherData.hourly.time[i], // "2025-05-18T01:00" 슬라이싱?
temperature: weatherData.hourly.temperature_2m[i],
code: weatherData.hourly.weather_code[i],
};

Choose a reason for hiding this comment

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

포매팅!

Copy link
Author

Choose a reason for hiding this comment

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

여기도!

if (!timeString) return "time Error";

const date = new Date(timeString);
const days = ["일", "월", "화", "수", "목", "금", "토"];

Choose a reason for hiding this comment

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

각 요일을 상수화해서 별도 파일에 보관하면 좋을 것 같아요!

Copy link
Author

Choose a reason for hiding this comment

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

const sunday = "일";
const monday = "월";

이런식으로 하라는 말씀이신가요?????

Comment on lines +19 to +22
const month = date.getMonth() + 1;
const day = date.getDate();

return `${month}${day}일 (${dayOfWeek})`;

Choose a reason for hiding this comment

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

포매팅!

Copy link
Author

Choose a reason for hiding this comment

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

확인했습니다!

const degree = weatherData.daily_units.temperature_2m_max;

const splitTime = (timeString) => {
if (!timeString) return "time Error";

Choose a reason for hiding this comment

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

만약 데이터가 불완전하다면 에러를 사용자에게 보여주는 로직 아주 좋습니다 👍

Copy link
Author

Choose a reason for hiding this comment

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

감사합니다 ㅎ 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants