Skip to content

Commit ac3ac92

Browse files
committed
feat: make responsive
1 parent 1806cab commit ac3ac92

File tree

1 file changed

+70
-17
lines changed
  • src/pages/office-utilization/[location]

1 file changed

+70
-17
lines changed

src/pages/office-utilization/[location]/index.tsx

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Button,
66
Card,
77
Container,
8+
Flex,
89
Grid,
910
Heading,
1011
Icon,
@@ -202,7 +203,14 @@ const OfficeUtilizationPage = (
202203
</Text>
203204
<Stack>
204205
<Box paddingY={4} borderRadius={"md"}>
205-
<Grid templateColumns="repeat(4, 1fr)" gap="6" width={"100%"}>
206+
<Grid
207+
templateColumns={{
208+
base: "repeat(2, 1fr)",
209+
md: "repeat(4, 1fr)",
210+
}}
211+
gap="6"
212+
width={"100%"}
213+
>
206214
<Box
207215
backgroundColor={"white"}
208216
padding={2}
@@ -323,9 +331,19 @@ const OfficeUtilizationPage = (
323331
<Box marginTop={12}>
324332
<Container maxW="4xl">
325333
<Grid templateColumns="repeat(1, 1fr)" gapY={"8"}>
326-
<Grid templateColumns="repeat(12, 1fr)" gapX={"12"}>
334+
<Grid
335+
templateColumns={{
336+
base: "repeat(1, 1fr)",
337+
md: "repeat(12, 1fr)",
338+
}}
339+
gapX={"12"}
340+
gapY={{ base: "6", md: "0" }}
341+
>
327342
<Card.Root
328-
gridColumn="span 7 / span 7"
343+
gridColumn={{
344+
base: "span 1 / span 1",
345+
md: "span 7 / span 7",
346+
}}
329347
width="100%"
330348
variant={"outline"}
331349
colorPalette="orange"
@@ -338,7 +356,12 @@ const OfficeUtilizationPage = (
338356
</Card.Description>
339357
</Card.Body>
340358
</Card.Root>
341-
<Box gridColumn="span 5 / span 5">
359+
<Box
360+
gridColumn={{
361+
base: "span 1 / span 1",
362+
md: "span 5 / span 5",
363+
}}
364+
>
342365
<Heading>Interpretation</Heading>
343366
<List.Root paddingLeft={4}>
344367
<List.Item>Return-to-office push increasing</List.Item>
@@ -349,8 +372,20 @@ const OfficeUtilizationPage = (
349372
</List.Root>
350373
</Box>
351374
</Grid>
352-
<Grid templateColumns="repeat(12, 1fr)" gapX={"12"}>
353-
<Box gridColumn="span 5 / span 5">
375+
<Grid
376+
templateColumns={{
377+
base: "repeat(1, 1fr)",
378+
md: "repeat(12, 1fr)",
379+
}}
380+
gapX={"12"}
381+
gapY={{ base: "6", md: "0" }}
382+
>
383+
<Box
384+
gridColumn={{
385+
base: "span 1 / span 1",
386+
md: "span 5 / span 5",
387+
}}
388+
>
354389
<Heading>Cost Implications</Heading>
355390
<List.Root paddingLeft={4}>
356391
<List.Item>
@@ -365,7 +400,12 @@ const OfficeUtilizationPage = (
365400
</List.Item>
366401
</List.Root>
367402
</Box>
368-
<Box gridColumn="span 7 / span 7">
403+
<Box
404+
gridColumn={{
405+
base: "span 1 / span 1",
406+
md: "span 7 / span 7",
407+
}}
408+
>
369409
<Heading>How {City} Compares Globally</Heading>
370410
<Box marginTop={2}>
371411
<Chart.Root
@@ -427,9 +467,14 @@ const OfficeUtilizationPage = (
427467
<Heading as={"h2"} fontWeight={500}>
428468
Related Office Utilization Pages
429469
</Heading>
430-
<Stack direction="row" gap={2}>
431-
{comparisonCities.map((city, index) => (
432-
<>
470+
<Flex
471+
direction={{ base: "column", md: "row" }}
472+
gap={2}
473+
flexWrap="wrap"
474+
align={{ base: "flex-start", md: "center" }}
475+
>
476+
{comparisonCities.flatMap((city, index) => {
477+
const items = [
433478
<Box key={city.city}>
434479
<Link colorPalette="orange" asChild>
435480
<NextLink
@@ -438,13 +483,21 @@ const OfficeUtilizationPage = (
438483
<Text textWrap={"nowrap"}>{city.city}</Text>
439484
</NextLink>
440485
</Link>
441-
</Box>
442-
{index < comparisonCities.length - 1 && (
443-
<Box borderWidth={0}>{"•"}</Box>
444-
)}
445-
</>
446-
))}
447-
</Stack>
486+
</Box>,
487+
];
488+
if (index < comparisonCities.length - 1) {
489+
items.push(
490+
<Box
491+
key={`separator-${index}`}
492+
display={{ base: "none", md: "block" }}
493+
>
494+
{"•"}
495+
</Box>,
496+
);
497+
}
498+
return items;
499+
})}
500+
</Flex>
448501
</Container>
449502
</Box>
450503

0 commit comments

Comments
 (0)