diff --git a/src/components/Dashboard/Wrappers/Sidebar/Sidebar.tsx b/src/components/Dashboard/Wrappers/Sidebar/Sidebar.tsx
index a8bd89ebe..d7fbbdb68 100644
--- a/src/components/Dashboard/Wrappers/Sidebar/Sidebar.tsx
+++ b/src/components/Dashboard/Wrappers/Sidebar/Sidebar.tsx
@@ -42,7 +42,6 @@ const SidebarInner = ({ location }: DashboardSidebarInnerProps) => {
className="grid-stack grid-stack-sidebar"
style={{ transitionDuration: '0s', height: '100%' }}
data-sidebar={location}
- // eslint-disable-next-line react/no-unknown-property
gs-min-row={minRow}
>
diff --git a/src/widgets/date/DateTile.tsx b/src/widgets/date/DateTile.tsx
index 5e830a792..b9f005873 100644
--- a/src/widgets/date/DateTile.tsx
+++ b/src/widgets/date/DateTile.tsx
@@ -1,4 +1,5 @@
import { Stack, Text, Title } from '@mantine/core';
+import { useElementSize } from '@mantine/hooks';
import { IconClock } from '@tabler/icons';
import dayjs from 'dayjs';
import { useEffect, useRef, useState } from 'react';
@@ -16,7 +17,7 @@ const definition = defineWidget({
},
},
gridstack: {
- minWidth: 2,
+ minWidth: 1,
minHeight: 1,
maxWidth: 12,
maxHeight: 12,
@@ -33,11 +34,12 @@ interface DateTileProps {
function DateTile({ widget }: DateTileProps) {
const date = useDateState();
const formatString = widget.properties.display24HourFormat ? 'HH:mm' : 'h:mm A';
+ const { width, height, ref } = useElementSize();
return (
-
+
{dayjs(date).format(formatString)}
- {dayjs(date).format('dddd, MMMM D')}
+ {width > 200 && {dayjs(date).format('dddd, MMMM D')}}
);
}
diff --git a/src/widgets/weather/WeatherTile.tsx b/src/widgets/weather/WeatherTile.tsx
index b053a0a2a..ad8efde4d 100644
--- a/src/widgets/weather/WeatherTile.tsx
+++ b/src/widgets/weather/WeatherTile.tsx
@@ -1,4 +1,5 @@
import { Center, Group, Skeleton, Stack, Text, Title } from '@mantine/core';
+import { useElementSize } from '@mantine/hooks';
import { IconArrowDownRight, IconArrowUpRight, IconCloudRain } from '@tabler/icons';
import { defineWidget } from '../helper';
import { IWidget } from '../widgets';
@@ -19,7 +20,7 @@ const definition = defineWidget({
},
},
gridstack: {
- minWidth: 2,
+ minWidth: 1,
minHeight: 1,
maxWidth: 12,
maxHeight: 12,
@@ -35,10 +36,17 @@ interface WeatherTileProps {
function WeatherTile({ widget }: WeatherTileProps) {
const { data: weather, isLoading, isError } = useWeatherForCity(widget.properties.location);
+ const { width, height, ref } = useElementSize();
if (isLoading) {
return (
- <>
+
@@ -47,7 +55,7 @@ function WeatherTile({ widget }: WeatherTileProps) {
- >
+
);
}
@@ -62,32 +70,35 @@ function WeatherTile({ widget }: WeatherTileProps) {
// TODO: add widgetWrapper that is generic and uses the definition
return (
-
+
-
+
{getPerferedUnit(
weather!.current_weather.temperature,
widget.properties.displayInFahrenheit
)}
-
-
- {getPerferedUnit(
- weather!.daily.temperature_2m_max[0],
- widget.properties.displayInFahrenheit
- )}
-
- {getPerferedUnit(
- weather!.daily.temperature_2m_min[0],
- widget.properties.displayInFahrenheit
- )}
-
+ {width > 200 && (
+
+
+ {getPerferedUnit(
+ weather!.daily.temperature_2m_max[0],
+ widget.properties.displayInFahrenheit
+ )}
+
+ {getPerferedUnit(
+ weather!.daily.temperature_2m_min[0],
+ widget.properties.displayInFahrenheit
+ )}
+
+ )}
);
}