mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 15:05:48 +01:00
✨ Add skeleton while the meto module is loading
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Group, Space, Title, Tooltip } from '@mantine/core';
|
import { Group, Space, Title, Tooltip, Skeleton } from '@mantine/core';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
@@ -157,7 +157,18 @@ export default function WeatherComponent(props: any) {
|
|||||||
});
|
});
|
||||||
}, [cityInput]);
|
}, [cityInput]);
|
||||||
if (!weather.current_weather) {
|
if (!weather.current_weather) {
|
||||||
return null;
|
return (
|
||||||
|
<>
|
||||||
|
<Skeleton height={40} width={100} mb="xl" />
|
||||||
|
<Group noWrap direction="row">
|
||||||
|
<Skeleton height={50} circle />
|
||||||
|
<Group>
|
||||||
|
<Skeleton height={25} width={70} mr="lg" />
|
||||||
|
<Skeleton height={25} width={70} />
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
function usePerferedUnit(value: number): string {
|
function usePerferedUnit(value: number): string {
|
||||||
return isFahrenheit ? `${(value * (9 / 5) + 32).toFixed(1)}°F` : `${value.toFixed(1)}°C`;
|
return isFahrenheit ? `${(value * (9 / 5) + 32).toFixed(1)}°F` : `${value.toFixed(1)}°C`;
|
||||||
|
|||||||
Reference in New Issue
Block a user