-
Notifications
You must be signed in to change notification settings - Fork 19
7주차 홍석준 과제 완료 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lastro1206
wants to merge
4
commits into
TEAM-ALOM:main
Choose a base branch
from
lastro1206:feature/homework
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,10 +8,20 @@ import { getWeatherDescription } from "../utils/weather"; | |
|
|
||
| const CurrentWeather = ({ weatherData, isLoading }) => { | ||
| if (isLoading) { | ||
| return <div>채워주세요</div>; | ||
| return <div>로딩 중...</div>; | ||
| } | ||
|
|
||
| return <div>채워주세요</div>; | ||
| const temperature = weatherData?.current_weather?.temperature; | ||
| const code = weatherData?.current_weather?.weathercode; | ||
|
|
||
| return ( | ||
| <div> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 div로 안묶어줘도 될 거 같아요 |
||
| <CurrentWeatherWrapper> | ||
| <Temperature>{Math.round(temperature)}°C</Temperature> | ||
| <WeatherCode>{getWeatherDescription(code)}</WeatherCode> | ||
| </CurrentWeatherWrapper> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default CurrentWeather; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,22 @@ | ||
| import React from "react"; | ||
| import { DailyForecastWrapper, DailyItem } from "./styles/StyledComponents"; | ||
| import { getWeatherDescription, formatDailyData } from "../utils/weather"; | ||
| import { formatKoreanDate } from "../utils/date"; | ||
|
|
||
| const DailyForecast = ({ weatherData }) => { | ||
| const dailyData = formatDailyData(weatherData); | ||
|
|
||
| return <div>채워주세요</div>; | ||
| return ( | ||
| <DailyForecastWrapper> | ||
| {dailyData.map((item, index) => ( | ||
| <DailyItem key={index}> | ||
| <div>{formatKoreanDate(item.date)}</div> | ||
| <div>{getWeatherDescription(item.weatherCode)}</div> | ||
| <div>{Math.round(item.maxTemp)}°C</div> | ||
| </DailyItem> | ||
| ))} | ||
| </DailyForecastWrapper> | ||
| ); | ||
| }; | ||
|
|
||
| export default DailyForecast; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,22 @@ import { HourlyForecastWrapper, HourlyItem } from "./styles/StyledComponents"; | |
| import { getWeatherDescription, formatHourlyData } from "../utils/weather"; | ||
|
|
||
| const HourlyForecast = ({ weatherData }) => { | ||
| const hourlyData = formatHourlyData(weatherData); | ||
| const hourlyData = formatHourlyData(weatherData).slice(0, 12); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기서는 크게 상관 없을 수 있지만, |
||
|
|
||
| return <div>채워주세요</div>; | ||
| return ( | ||
| <HourlyForecastWrapper> | ||
| {hourlyData.map((item, index) => { | ||
| const hour = parseInt(item.time.slice(0, 2), 10); // "00:00" -> 0 | ||
| return ( | ||
| <HourlyItem key={index}> | ||
| <div>{hour}시</div> | ||
| <div>{Math.round(item.temperature)}°C</div> | ||
| <div>{getWeatherDescription(item.weatherCode)}</div> | ||
| </HourlyItem> | ||
| ); | ||
| })} | ||
| </HourlyForecastWrapper> | ||
| ); | ||
| }; | ||
|
|
||
| export default HourlyForecast; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export const formatKoreanDate = (isoDateStr) => { | ||
| const date = new Date(isoDateStr); | ||
| const month = date.getMonth() + 1; // 0부터 시작하므로 +1 | ||
| const day = date.getDate(); | ||
| const weekdayNames = ["일", "월", "화", "수", "목", "금", "토"]; | ||
| const weekday = weekdayNames[date.getDay()]; | ||
|
|
||
| return `${month}월 ${day}일 (${weekday})`; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메세지 하드 코딩보다는 별도 컴포넌트를 두면 더 좋을 듯 합니당