Skip to content

Commit 11c0235

Browse files
authored
Merge pull request #229 from CivicDataLab/fix/mobile-responsiveness
Improve mobile responsiveness and layout adjustments
2 parents 9a05262 + 5b98bdd commit 11c0235

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

app/[locale]/[state]/analytics/components/analytics-mobile-layout.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,11 @@ export function AnalyticsMobileLayout({
294294
<section className="flex h-full flex-col items-center justify-center gap-2 bg-[#FFFF]">
295295
<div
296296
className={cn(
297-
'relative h-[calc(100dvh_-_140px)] w-full flex-grow flex-col gap-3 overflow-y-scroll '
297+
'relative h-[calc(100dvh_-_160px)] w-full flex-grow flex-col gap-3 overflow-y-scroll'
298+
// 'sm:h-[calc(100dvh_-_120px)] md:h-[calc(100dvh_-_100px)]'
298299
)}
299300
>
300-
<div className="fixed top-[56px] z-9 flex h-[6%] w-full items-center bg-[#FFFF] px-4">
301+
<div className="fixed top-[56px] z-9 flex h-[8vh] w-full items-center bg-[#FFFF] px-4 sm:h-[6%] sm:px-6 md:h-[5%] md:px-8">
301302
<FactorList currentState={currentSelectedState} />
302303
<FilterComp
303304
timePeriod={timePeriod}
@@ -329,7 +330,7 @@ export function AnalyticsMobileLayout({
329330
/>
330331
)}
331332

332-
<div className="sticky bottom-0 flex h-[86px] w-full flex-row justify-between gap-1 bg-baseIndigoSolid1 p-1">
333+
<div className="sticky bottom-0 flex h-[8vh] w-full flex-row justify-between gap-1 bg-baseIndigoSolid1 p-1 sm:p-2 md:p-3">
333334
{buttons.map((button, index) =>
334335
button.value === 'more' ? (
335336
// Render Menu for 'More' button

app/[locale]/[state]/analytics/components/map-component.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const MapComponent = ({
4949
const districtCode = params.get('district-code');
5050

5151
const { width } = useWindowSize();
52-
const isMobile = width < 768;
52+
const isMobile = width < 1023;
5353

5454
const values = [];
5555
for (let i = 0; i < mapFeatures?.length; i++) {
@@ -281,8 +281,11 @@ export const MapComponent = ({
281281
return (
282282
<>
283283
{' '}
284+
{/* <div
285+
className={`relative w-full ${isMobile ? 'h-full' : 'h-[98%]'} ${isMobile ? 'pt-[68px]' : ''}`}
286+
> */}
284287
<div
285-
className={`relative w-full ${isMobile ? 'h-full' : 'h-[90%]'} ${isMobile ? 'pt-[66px]' : ''}`}
288+
className={`relative w-full ${isMobile ? 'h-full pt-[84px] sm:pt-[66px] md:pt-[50px]' : 'h-[95vh]'} sm:h-[85vh] md:h-[86vh]`}
286289
>
287290
{' '}
288291
<MapChart

app/[locale]/[state]/analytics/components/output-window.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export function OutputWindow({
297297
</section>
298298
</aside>
299299
</MediaRendering>
300-
<MediaRendering minWidth={null} maxWidth="1023">
300+
<MediaRendering minWidth={null} maxWidth="1024">
301301
{/* MOBILE */}
302302

303303
{view === 'map' && (
@@ -307,7 +307,8 @@ export function OutputWindow({
307307
className={cn(
308308
'pb-2 pl-4 pr-4',
309309
'bg-surfaceDefault shadow-basicMd',
310-
'shadow-inset min-w-[373px] max-w-[380px] shrink-0 flex-row md:block',
310+
// 'shadow-inset min-w-[373px] max-w-[380px] shrink-0 flex-row md:block md:w-[90%]',
311+
'shadow-inset w-full shrink-0 flex-row md:block md:w-[90%]',
311312
'overflow-y-auto border-b-1 border-l-1 border-r-1 border-solid border-borderSubdued',
312313
styles.mobileOverlay,
313314
region !== null &&
@@ -502,13 +503,11 @@ export function OtherFactorScores({
502503
return FactorVariables.filter(
503504
(scoreType: any) => typeof data[scoreType] === 'object'
504505
).map((scoreType) => (
505-
506506
<div key={scoreType} className=" flex items-center gap-4">
507507
{/* //change */}
508508
<div className="flex-shrink-0">
509509
<div className="h-6 w-6">{IconMap[scoreType]}</div>
510510
</div>
511-
512511
{indicator === 'risk-score' && (
513512
<Text className="shrink-1 min-w-[200px]">
514513
{getFactorNameBySlug(factorData, scoreType)}

app/[locale]/[state]/analytics/components/styles.module.scss

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
position: absolute;
1616
top: 145px;
1717
right: -100%; /* Hide off-screen initially */
18-
z-index: 99999;
18+
z-index: 99999;
1919
height: calc(100dvh - 30%);
2020
opacity: 90%;
2121
box-shadow: var(--shadow-basic-md);
@@ -41,22 +41,22 @@
4141
min-width: 300px;
4242
}
4343

44-
.mobileOverlayActive {
45-
bottom: 86px;
46-
right: 0;
47-
}
44+
// .mobileOverlayActive {
45+
// bottom: 86px;
46+
// right: 0;
47+
// }
4848

49-
.expandedOverlay {
50-
bottom: 86px;
51-
height: calc(100dvh - 160px);
52-
}
49+
// .expandedOverlay {
50+
// bottom: 86px;
51+
// height: calc(100dvh - 160px);
52+
// }
5353

54-
@media (max-width: 480px) {
55-
.mobileOverlay {
56-
max-width: 100%;
57-
min-width: 280px;
58-
}
59-
}
54+
// @media (max-width: 480px) {
55+
// .mobileOverlay {
56+
// max-width: 100%;
57+
// min-width: 280px;
58+
// }
59+
// }
6060

6161
.bottomDrawer {
6262
position: absolute;
@@ -95,19 +95,20 @@
9595
}
9696

9797
.mobileOverlayActive {
98-
bottom: 80px;
99-
right: 5px;
98+
bottom: 8vh;
99+
right: 3px;
100100
}
101101

102102
.expandedOverlay {
103-
bottom: 80px;
104-
height: calc(100dvh - 160px);
103+
bottom: 8vh;
104+
height: calc(100dvh - 63px - 8vh);
105105
}
106106

107-
@media (max-width: 480px) {
107+
@media (max-width: 1023px) {
108108
.mobileOverlay {
109109
max-width: 100%;
110110
min-width: 280px;
111+
bottom: 8vh;
111112
}
112113
}
113114

0 commit comments

Comments
 (0)