Skip to content

Commit 89bc83c

Browse files
committed
fix dual pihole widget spacing on mobile
1 parent 1a9f498 commit 89bc83c

File tree

3 files changed

+47
-37
lines changed

3 files changed

+47
-37
lines changed

frontend/src/components/dashboard/base-items/widgets/DualWidget.tsx

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -114,45 +114,55 @@ export const DualWidget: React.FC<DualWidgetProps> = ({
114114
>
115115
<Box
116116
sx={{
117-
flex: isMobile ? '1 1 50%' : 1,
118-
overflow: 'hidden',
119117
display: 'flex',
120118
flexDirection: 'column',
121-
mb: 0.5,
122-
justifyContent: 'center',
123-
position: 'relative',
124-
minHeight: isMobile ? DUAL_WIDGET_SECTION_HEIGHT.xs : DUAL_WIDGET_SECTION_HEIGHT.sm,
125-
maxHeight: isMobile ? 'unset' : DUAL_WIDGET_SECTION_HEIGHT.sm,
126-
height: isMobile ? DUAL_WIDGET_SECTION_HEIGHT.xs : DUAL_WIDGET_SECTION_HEIGHT.sm
119+
width: '100%',
120+
height: '100%',
121+
flex: 1,
127122
}}
128123
>
129-
{renderWidget(config?.topWidget, 'top')}
130-
</Box>
124+
<Box
125+
sx={{
126+
flex: 1,
127+
overflow: 'hidden',
128+
display: 'flex',
129+
flexDirection: 'column',
130+
mb: 0.5,
131+
justifyContent: 'center',
132+
position: 'relative',
133+
minHeight: isMobile ? 'unset' : DUAL_WIDGET_SECTION_HEIGHT.sm,
134+
maxHeight: isMobile ? 'none' : DUAL_WIDGET_SECTION_HEIGHT.sm,
135+
height: isMobile ? 'auto' : DUAL_WIDGET_SECTION_HEIGHT.sm
136+
}}
137+
>
138+
{renderWidget(config?.topWidget, 'top')}
139+
</Box>
131140

132-
<Divider
133-
sx={{
134-
borderColor: 'rgba(255,255,255,0.2)',
135-
width: '100%',
136-
my: 0.25,
137-
height: '1px'
138-
}}
139-
/>
141+
<Divider
142+
sx={{
143+
borderColor: 'rgba(255,255,255,0.2)',
144+
width: '100%',
145+
my: 0.25,
146+
height: '1px'
147+
}}
148+
/>
140149

141-
<Box
142-
sx={{
143-
flex: isMobile ? '1 1 50%' : 1,
144-
overflow: 'hidden',
145-
display: 'flex',
146-
flexDirection: 'column',
147-
mt: 0.5,
148-
justifyContent: 'center',
149-
position: 'relative',
150-
minHeight: isMobile ? DUAL_WIDGET_SECTION_HEIGHT.xs : DUAL_WIDGET_SECTION_HEIGHT.sm,
151-
maxHeight: isMobile ? 'unset' : DUAL_WIDGET_SECTION_HEIGHT.sm,
152-
height: isMobile ? DUAL_WIDGET_SECTION_HEIGHT.xs : DUAL_WIDGET_SECTION_HEIGHT.sm
153-
}}
154-
>
155-
{renderWidget(config?.bottomWidget, 'bottom')}
150+
<Box
151+
sx={{
152+
flex: 1,
153+
overflow: 'hidden',
154+
display: 'flex',
155+
flexDirection: 'column',
156+
mt: 0.5,
157+
justifyContent: 'center',
158+
position: 'relative',
159+
minHeight: isMobile ? 'unset' : DUAL_WIDGET_SECTION_HEIGHT.sm,
160+
maxHeight: isMobile ? 'none' : DUAL_WIDGET_SECTION_HEIGHT.sm,
161+
height: isMobile ? 'auto' : DUAL_WIDGET_SECTION_HEIGHT.sm
162+
}}
163+
>
164+
{renderWidget(config?.bottomWidget, 'bottom')}
165+
</Box>
156166
</Box>
157167
</DualWidgetContainer>
158168
);

frontend/src/components/dashboard/base-items/widgets/DualWidgetContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const DualWidgetContainer: React.FC<DualWidgetContainerProps> = ({
2828
<Card
2929
sx={{
3030
width: '100%',
31-
height: '100%',
31+
height: isMobile ? 'auto' : '100%',
3232
maxWidth: '100%',
3333
minWidth: 0,
3434
flexGrow: 1,
@@ -59,7 +59,7 @@ export const DualWidgetContainer: React.FC<DualWidgetContainerProps> = ({
5959
},
6060
display: 'flex',
6161
flexDirection: 'column',
62-
height: '100%',
62+
height: isMobile ? 'auto' : '100%',
6363
width: '100%',
6464
justifyContent: 'center',
6565
alignItems: 'center',

frontend/src/components/dashboard/base-items/widgets/PiholeWidget/PiholeWidget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ export const PiholeWidget = (props: { config?: PiholeWidgetConfig }) => {
988988
const percentageText = blockPercentage.toFixed(1);
989989

990990
return (
991-
<Box sx={{ p: 0.5, height: '100%' }}>
991+
<Box sx={{ p: 0.5, height: '100%', display: 'flex', flexDirection: 'column' }}>
992992
<Box sx={{
993993
display: 'flex',
994994
alignItems: 'center',
@@ -1065,7 +1065,7 @@ export const PiholeWidget = (props: { config?: PiholeWidgetConfig }) => {
10651065
</Menu>
10661066
</Box>
10671067

1068-
<Grid container spacing={0.4}>
1068+
<Grid container spacing={0.4} sx={{ flex: 1 }}>
10691069
{/* Blocked Today */}
10701070
<Grid size={{ xs: 6 }}>
10711071
<Paper

0 commit comments

Comments
 (0)