mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-17 18:51:14 +01:00
Weather widget styling
This commit is contained in:
@@ -30,7 +30,7 @@ export const WeatherIcon = ({ code }: WeatherIconProps) => {
|
|||||||
return (
|
return (
|
||||||
<Tooltip withinPortal withArrow label={t(`card.weatherDescriptions.${name}`)}>
|
<Tooltip withinPortal withArrow label={t(`card.weatherDescriptions.${name}`)}>
|
||||||
<Box>
|
<Box>
|
||||||
<Icon size={50} />
|
<Icon style={{ float: 'left' }} size={50} />
|
||||||
</Box>
|
</Box>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const definition = defineWidget({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
gridstack: {
|
gridstack: {
|
||||||
minWidth: 4,
|
minWidth: 2,
|
||||||
minHeight: 2,
|
minHeight: 2,
|
||||||
maxWidth: 12,
|
maxWidth: 12,
|
||||||
maxHeight: 12,
|
maxHeight: 12,
|
||||||
@@ -61,39 +61,34 @@ function WeatherTile({ widget }: WeatherTileProps) {
|
|||||||
|
|
||||||
// TODO: add widgetWrapper that is generic and uses the definition
|
// TODO: add widgetWrapper that is generic and uses the definition
|
||||||
return (
|
return (
|
||||||
<Center style={{ height: '100%' }}>
|
<Stack
|
||||||
<Group spacing="md" noWrap align="center">
|
spacing="xs"
|
||||||
|
justify="space-around"
|
||||||
|
align="center"
|
||||||
|
style={{ height: '100%', width: '100%' }}
|
||||||
|
>
|
||||||
|
<Group grow>
|
||||||
<WeatherIcon code={weather!.current_weather.weathercode} />
|
<WeatherIcon code={weather!.current_weather.weathercode} />
|
||||||
<Stack p={0} spacing={4}>
|
|
||||||
<Title order={2}>
|
<Title order={2}>
|
||||||
{getPerferedUnit(
|
{getPerferedUnit(
|
||||||
weather!.current_weather.temperature,
|
weather!.current_weather.temperature,
|
||||||
widget.properties.displayInFahrenheit
|
widget.properties.displayInFahrenheit
|
||||||
)}
|
)}
|
||||||
</Title>
|
</Title>
|
||||||
<Group spacing="xs" noWrap>
|
</Group>
|
||||||
<div>
|
<Group noWrap spacing="xs">
|
||||||
<span>
|
<IconArrowUpRight />
|
||||||
{getPerferedUnit(
|
{getPerferedUnit(
|
||||||
weather!.daily.temperature_2m_max[0],
|
weather!.daily.temperature_2m_max[0],
|
||||||
widget.properties.displayInFahrenheit
|
widget.properties.displayInFahrenheit
|
||||||
)}
|
)}
|
||||||
</span>
|
<IconArrowDownRight />
|
||||||
<IconArrowUpRight size={16} style={{ right: 15 }} />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span>
|
|
||||||
{getPerferedUnit(
|
{getPerferedUnit(
|
||||||
weather!.daily.temperature_2m_min[0],
|
weather!.daily.temperature_2m_min[0],
|
||||||
widget.properties.displayInFahrenheit
|
widget.properties.displayInFahrenheit
|
||||||
)}
|
)}
|
||||||
</span>
|
|
||||||
<IconArrowDownRight size={16} />
|
|
||||||
</div>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Group>
|
|
||||||
</Center>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user