Skip to content

Commit 93c103b

Browse files
authored
fix qr code display on mobile (#25)
1 parent 82e33d4 commit 93c103b

1 file changed

Lines changed: 38 additions & 12 deletions

File tree

src/pages/Home.page.tsx

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
Divider,
1515
Box,
1616
Modal,
17+
Flex,
1718
} from '@mantine/core';
1819
import { useDisclosure } from '@mantine/hooks';
1920
import { IconCalendarEvent, IconTicket, IconSettings, IconCalendar, IconClock, IconMapPin, IconQrcode } from '@tabler/icons-react';
@@ -79,25 +80,41 @@ export function HomePage() {
7980

8081
{isLoggedIn && netId && (
8182
<Card shadow="sm" padding="lg" radius="md" withBorder>
82-
<Group justify="space-between" wrap="nowrap" align="center">
83-
<Group gap="md" wrap="nowrap" align="center">
83+
<Flex
84+
direction={{ base: 'column', sm: 'row' }}
85+
align="center"
86+
justify="space-between"
87+
gap="md"
88+
>
89+
<Flex
90+
direction={{ base: 'column', sm: 'row' }}
91+
align="center"
92+
gap="md"
93+
style={{ minWidth: 0 }}
94+
>
8495
<Box p="xs" bg="white" style={{ borderRadius: 8, lineHeight: 0 }}>
8596
<QRCode value={netId} size={88} />
8697
</Box>
87-
<Box>
88-
<Group gap="xs" mb={4}>
89-
<ThemeIcon color="blue" variant="light" size="m">
90-
<IconQrcode size={24} />
98+
<Box ta={{ base: 'center', sm: 'left' }} style={{ minWidth: 0 }}>
99+
<Flex gap="xs" align="center" justify={{ base: 'center', sm: 'flex-start' }} mb={4}>
100+
<ThemeIcon color="blue" variant="light" size="md">
101+
<IconQrcode size={18} />
91102
</ThemeIcon>
92103
<Text fw={500}>Check-In QR Code</Text>
93-
</Group>
104+
</Flex>
94105
<Text size="sm" c="dimmed">Show this at events to check in.</Text>
95106
</Box>
96-
</Group>
97-
<Button variant="light" radius="md" onClick={openQr}>
107+
</Flex>
108+
<Button
109+
variant="light"
110+
radius="md"
111+
onClick={openQr}
112+
w={{ base: '100%', sm: 'auto' }}
113+
style={{ flexShrink: 0 }}
114+
>
98115
Enlarge
99116
</Button>
100-
</Group>
117+
</Flex>
101118
</Card>
102119
)}
103120

@@ -204,8 +221,17 @@ export function HomePage() {
204221

205222
<Modal opened={qrOpened} onClose={closeQr} title="Check-In Code" centered size="sm">
206223
<Stack align="center" gap="sm" py="md">
207-
<Box p="md" bg="white" style={{ borderRadius: 8, lineHeight: 0 }}>
208-
<QRCode value={netId} size={220} />
224+
<Box
225+
p="md"
226+
bg="white"
227+
style={{ borderRadius: 8, lineHeight: 0, width: '100%', maxWidth: 260 }}
228+
>
229+
<QRCode
230+
value={netId}
231+
size={256}
232+
viewBox="0 0 256 256"
233+
style={{ width: '100%', height: 'auto' }}
234+
/>
209235
</Box>
210236
<Text size="xs" c="dimmed">Show this at events to check in</Text>
211237
</Stack>

0 commit comments

Comments
 (0)