-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor<Week>: Week 컴포넌트 여러 컴포넌트로 분리 및 컴포넌트 개별 파일로 이동, Week.tsx 파일명 …
…index.tsx로 변경
- Loading branch information
1 parent
dba9184
commit 5599de2
Showing
4 changed files
with
60 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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,24 @@ | ||
import React from "react"; | ||
import { AmPmType } from "../../../modules"; | ||
import SkyIcon from "../SkyIcon"; | ||
|
||
type AmPmProperty = { | ||
data: AmPmType; | ||
am: boolean; | ||
}; | ||
|
||
const AmPm = ({ data, am }: AmPmProperty) => { | ||
return ( | ||
<div className={`weather_inner ${am ? "am" : "pm"}`}> | ||
<strong className="inner_text left"> | ||
<span className="time-part">{am ? "오전" : "오후"}</span> | ||
<span className={`rainfall ${data.pop === 0 ? "none" : ""}`}> | ||
{Math.round(data.pop)}% | ||
</span> | ||
</strong> | ||
<SkyIcon skyType={data.sky} daytime={true} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default React.memo(AmPm); |
This file contains 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 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,30 @@ | ||
import React from "react"; | ||
import { Day } from "../../../modules/weather"; | ||
import Item from "./Item"; | ||
|
||
type WeekProperty = { | ||
week: Day[]; | ||
}; | ||
|
||
const Week = ({ week }: WeekProperty) => { | ||
const twoDays = week.slice(0, 2); | ||
return ( | ||
<div className="week" aria-details="주간 예보"> | ||
<h2 className="title">주간 예보</h2> | ||
<ul className="box"> | ||
{twoDays.map((d: Day) => ( | ||
<Item item={d} /> | ||
))} | ||
</ul> | ||
<div className="scrollControl"> | ||
<ul className="scrollArea"> | ||
{week.map((d: Day) => ( | ||
<Item item={d} /> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default React.memo(Week); |
This file contains 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