mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-13 04:22:09 +08:00
Fix weather icon DOM warnings
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
import mapIcon from "utils/weather/owm-condition-map";
|
||||
|
||||
export default function Icon({ condition, timeOfDay }) {
|
||||
const IconComponent = mapIcon(condition, timeOfDay);
|
||||
|
||||
return <IconComponent className="w-10 h-10 text-theme-800 dark:text-theme-200" />;
|
||||
}
|
||||
@@ -10,9 +10,7 @@ import ContainerButton from "../widget/container_button";
|
||||
import PrimaryText from "../widget/primary_text";
|
||||
import SecondaryText from "../widget/secondary_text";
|
||||
import WidgetIcon from "../widget/widget_icon";
|
||||
|
||||
import Icon from "./icon";
|
||||
|
||||
import mapIcon from "../../../utils/weather/owm-condition-map";
|
||||
|
||||
function Widget({ options }) {
|
||||
const { t, i18n } = useTranslation();
|
||||
@@ -35,15 +33,13 @@ function Widget({ options }) {
|
||||
|
||||
const unit = options.units === "metric" ? "celsius" : "fahrenheit";
|
||||
|
||||
const weatherInfo = {
|
||||
condition: data.weather[0].id,
|
||||
timeOfDay: data.dt > data.sys.sunrise && data.dt < data.sys.sunset ? "day" : "night"
|
||||
};
|
||||
const condition = data.weather[0].id;
|
||||
const timeOfDay = data.dt > data.sys.sunrise && data.dt < data.sys.sunset ? "day" : "night";
|
||||
|
||||
return <Container options={options}>
|
||||
<PrimaryText>{options.label && `${options.label}, ` }{t("common.number", { value: data.main.temp, style: "unit", unit })}</PrimaryText>
|
||||
<SecondaryText>{data.weather[0].description}</SecondaryText>
|
||||
<WidgetIcon icon={Icon} size="xl" weatherInfo={weatherInfo} />
|
||||
<WidgetIcon icon={mapIcon(condition, timeOfDay)} size="xl" />
|
||||
</Container>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user