-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce7e23d
commit d63410a
Showing
4 changed files
with
121 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import HumanFriendlyColumn from "@/app/components/HumanFriendlyColumn"; | ||
import { Box, Text } from "@mantine/core"; | ||
import React from "react"; | ||
|
||
export default function PageFooter() { | ||
return ( | ||
<Box mt="xl" mb="xl" component="footer"> | ||
<HumanFriendlyColumn> | ||
<Text mt="xs" c="dimmed"> | ||
Disclaimer: | ||
<br /> | ||
<br /> | ||
The information provided on this webpage is intended for reference | ||
purposes only. The summaries are generated by artificial intelligence | ||
and should not be regarded as fully accurate or comprehensive. The | ||
data is sourced exclusively from publicly available parliamentary | ||
sources online such as parliament.gov.sg. Users are advised to consult | ||
original parliamentary documents and official records for precise and | ||
authoritative information. | ||
</Text> | ||
</HumanFriendlyColumn> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.control { | ||
display: block; | ||
padding: var(--mantine-spacing-xs) var(--mantine-spacing-md); | ||
border-radius: var(--mantine-radius-md); | ||
font-weight: 500; | ||
} | ||
|
||
.control:hover { | ||
background-color: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
"use client"; | ||
|
||
import { | ||
AppShell, | ||
AppShellHeader, | ||
AppShellMain, | ||
Burger, | ||
Group, | ||
rem, | ||
UnstyledButton, | ||
} from "@mantine/core"; | ||
import React from "react"; | ||
import { useDisclosure, useHeadroom } from "@mantine/hooks"; | ||
import classes from "./StandardShell.module.css"; | ||
import PageFooter from "@/app/components/PageFooter"; | ||
import Link from "next/link"; | ||
|
||
type PageLink = { | ||
name: string; | ||
href: string; | ||
}; | ||
|
||
function generateButtonsFromLinks(links: PageLink[]) { | ||
return links.map(({ name, href }) => ( | ||
<UnstyledButton className={classes.control} component={Link} href={href}> | ||
{name} | ||
</UnstyledButton> | ||
)); | ||
} | ||
|
||
export default function StandardShell({ | ||
children, | ||
logo, | ||
links, | ||
}: { | ||
children: React.ReactNode; | ||
logo: React.ReactNode; | ||
links: PageLink[]; | ||
}) { | ||
const [opened, { toggle }] = useDisclosure(); | ||
const pinned = useHeadroom({ fixedAt: 120 }); | ||
const generatedButtons = generateButtonsFromLinks(links); | ||
|
||
return ( | ||
<AppShell | ||
header={{ height: 60, collapsed: !pinned, offset: false }} | ||
navbar={{ | ||
width: 300, | ||
breakpoint: "sm", | ||
collapsed: { desktop: true, mobile: !opened }, | ||
}} | ||
padding="md" | ||
> | ||
<AppShellHeader> | ||
<Group h="100%" px="md"> | ||
<Burger opened={opened} onClick={toggle} hiddenFrom="sm" size="sm" /> | ||
<Group justify="space-between" style={{ flex: 1 }}> | ||
{logo} | ||
<Group ml="xl" gap={0} visibleFrom="sm"> | ||
{generatedButtons} | ||
</Group> | ||
</Group> | ||
</Group> | ||
</AppShellHeader> | ||
|
||
<AppShell.Navbar py="md" px={4}> | ||
{generatedButtons} | ||
</AppShell.Navbar> | ||
|
||
<AppShellMain pt={`calc(${rem(60)} + var(--mantine-spacing-md))`}> | ||
{children} | ||
</AppShellMain> | ||
|
||
<PageFooter /> | ||
</AppShell> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters