Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bardolog1 committed Aug 8, 2023
1 parent 9494509 commit 59aa43a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
20 changes: 10 additions & 10 deletions src/components/DayWeatherCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ const DayWeatherCard = ({order, isCelsius, data}) => {
const date = useDateFormatted(data, order);

return (
<Container className={'_'+order}>
<TitleDay>{date?date:"Some Day"}</TitleDay>
<DayImageContainer>
<DayImage src={image} alt={description}/>
</DayImageContainer>
<DegreeContainer>
<Degree className="min">{min}{isCelsius?'°C':'°F'}</Degree>
<Degree className="max">{max}{isCelsius?'°C':'°F'}</Degree>
</DegreeContainer>
</Container>
<Container className={'_'+order}>
<TitleDay>{date?date:"Some Day"}</TitleDay>
<DayImageContainer>
<DayImage src={image} alt={description}/>
</DayImageContainer>
<DegreeContainer>
<Degree className="min">{min}{isCelsius?'°C':'°F'}</Degree>
<Degree className="max">{max}{isCelsius?'°C':'°F'}</Degree>
</DegreeContainer>
</Container>
)
}

Expand Down
20 changes: 10 additions & 10 deletions src/components/RightViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ const RightViewer = ({
const dispatcherData = (data, card)=>{
switch (card) {
case 1:
return data.filter((item) => isSomeDay(item.dt_txt,1));
return data?.filter((item) => isSomeDay(item.dt_txt,1));
case 2:
return data.filter((item) => isSomeDay(item.dt_txt,2));
return data?.filter((item) => isSomeDay(item.dt_txt,2));
case 3:
return data.filter((item) => isSomeDay(item.dt_txt,3));
return data?.filter((item) => isSomeDay(item.dt_txt,3));
case 4:
return data.filter((item) => isSomeDay(item.dt_txt,4));
return data?.filter((item) => isSomeDay(item.dt_txt,4));
case 5:
return data.filter((item) => isSomeDay(item.dt_txt,5));
return data?.filter((item) => isSomeDay(item.dt_txt,5));
default:
return null;
}
Expand Down Expand Up @@ -239,31 +239,31 @@ const RightViewer = ({
<DailyWeatherCardsContainer>
<DayWeatherCard
order='1'
data={dispatcherData(daylyData,1)}
data={dispatcherData(daylyData?daylyData:null,1)}
isCelsius={isCelsius}
></DayWeatherCard>
<DayWeatherCard
order='2'
isCelsius={isCelsius}
data={dispatcherData(daylyData,2)}
data={dispatcherData(daylyData?daylyData:null,2)}
>
</DayWeatherCard>
<DayWeatherCard
order='3'
isCelsius={isCelsius}
data={dispatcherData(daylyData,3)}
data={dispatcherData(daylyData?daylyData:null,3)}
>
</DayWeatherCard>
<DayWeatherCard
order='4'
isCelsius={isCelsius}
data={dispatcherData(daylyData,4)}
data={dispatcherData(daylyData?daylyData:null,4)}
>
</DayWeatherCard>
<DayWeatherCard
order='5'
isCelsius={isCelsius}
data={dispatcherData(daylyData,5)}
data={dispatcherData(daylyData?daylyData:null,5)}
>
</DayWeatherCard>
</DailyWeatherCardsContainer>
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useDateFormatted.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export function useDateFormatted(data, order) {

const getDate = () => {
if(
data !== null ||
data !== undefined ||
order !== null ||
data !== null &&
data !== undefined &&
order !== null &&
order !== undefined

) {
Expand Down

0 comments on commit 59aa43a

Please sign in to comment.