Skip to content

Commit

Permalink
강수량 처리 함수 구현(#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Db0111 committed Aug 25, 2024
1 parent 8f4f83c commit 3814048
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/pages/Home/components/weather/HandlePcp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@ import Clear from '@/components/icon/Pcp/PClear.svg';
import Rain from '@/components/icon/Pcp/PRain.svg';
import RainDrop from '@/components/icon/Pcp/PRaindrop.svg';

const handlePcP = (nowPcp: string) => {
if (!nowPcp) {
return null;
}
const HandlePcP = (nowPcp: string) => {

let PcpText = '';
let PcpIcon = null;


if (nowPcp === '강수없음') {
return <img src={Clear}
style={{width:'1rem', height:'1rem'}} alt='0%' />;
PcpText = '0mm';
PcpIcon = <img src={Clear} style={{width:'24px', height:'24px'}} alt='0%' />;
} else if (nowPcp === '1mm 미만' || Number(nowPcp.slice(0,3))< 3) {
return <img src={RainDrop}
style={{width:'1rem', height:'1rem'}} alt='10%' />;
PcpText = `${nowPcp}mm`;
PcpIcon = <img src={RainDrop} style={{width:'24px', height:'24px'}} alt='10%' />;
} else {
return <img src={Rain}
style={{width:'1rem', height:'1rem'}} alt='20%' />;
PcpText = `${nowPcp}mm`;
PcpIcon = <img src={Rain} style={{width:'24px', height:'24px'}} alt='20%' />;
}

return { PcpText, PcpIcon };

}
export default handlePcP;
export default HandlePcP;

0 comments on commit 3814048

Please sign in to comment.