Skip to content

Commit cc0e44b

Browse files
authored
Merge pull request #236 from openscript-ch/203-full-screen-mode-for-questionnaire
203 full screen mode for questionnaire
2 parents f003dcd + 7d1d6ba commit cc0e44b

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

.changeset/wicked-mangos-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@quassel/frontend": patch
3+
---
4+
5+
Introduce fullscreen mode in questionnaire

apps/frontend/src/routes/__root.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ function Root() {
5454
return (
5555
<>
5656
<AppShell
57-
header={{ height: 104 }}
58-
footer={{ height: 84 }}
57+
header={{ height: 104, collapsed: layoutStore.fullscreen }}
58+
footer={{ height: 84, collapsed: layoutStore.fullscreen }}
5959
navbar={{ width: 300, breakpoint: "sm", collapsed: { desktop: !layoutStore.admin } }}
6060
padding="xl"
6161
mod={{ admin: layoutStore.admin }}
@@ -100,6 +100,7 @@ function Root() {
100100
<AppShell.Main>
101101
<Outlet />
102102
</AppShell.Main>
103+
103104
<AppShell.Footer>
104105
<Group justify="space-between">
105106
<FooterLogos />
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1-
import { Container } from "@quassel/ui";
1+
import { ActionIcon, Affix, Container, IconMaximize, IconMaximizeOff, useFullscreen } from "@quassel/ui";
22
import { createFileRoute, Outlet } from "@tanstack/react-router";
3+
import { $layout } from "../../stores/layout";
4+
import { useEffect } from "react";
35

46
export const Route = createFileRoute("/_auth/questionnaire")({
57
component: QuestionnaireLayout,
68
});
79

810
function QuestionnaireLayout() {
11+
const { fullscreen, toggle } = useFullscreen();
12+
13+
useEffect(() => {
14+
$layout.set({ fullscreen });
15+
}, [fullscreen]);
16+
917
return (
10-
<Container size="md" mt="xl">
18+
<Container size={fullscreen ? "100%" : "md"} p={0} mt={fullscreen ? 0 : "xl"}>
1119
<Outlet />
20+
<Affix position={{ bottom: 110, right: 40 }}>
21+
<ActionIcon variant="outline" radius="xl" size="xl" onClick={toggle}>
22+
{fullscreen ? <IconMaximizeOff /> : <IconMaximize />}
23+
</ActionIcon>
24+
</Affix>
1225
</Container>
1326
);
1427
}

apps/frontend/src/stores/layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { map } from "nanostores";
22

33
type Layout = {
44
admin?: boolean;
5+
fullscreen?: boolean;
56
};
67

78
export const $layout = map<Layout>({});

libs/ui/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export {
6262
ColorSwatch,
6363
Divider,
6464
Flex,
65+
Affix,
6566
Group,
6667
InputError,
6768
InputLabel,
@@ -88,7 +89,7 @@ export {
8889

8990
export { TimeInput, DateInput } from "@mantine/dates";
9091

91-
export { useDisclosure } from "@mantine/hooks";
92+
export { useDisclosure, useFullscreen } from "@mantine/hooks";
9293

9394
export { notifications } from "@mantine/notifications";
9495

@@ -106,6 +107,8 @@ export {
106107
IconMapSearch,
107108
IconMinus,
108109
IconRepeat,
110+
IconMaximize,
111+
IconMaximizeOff,
109112
} from "@tabler/icons-react";
110113

111114
export { uzhColors } from "./theme/uzh";

0 commit comments

Comments
 (0)