Skip to content

Commit

Permalink
Page Layout WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert committed Nov 19, 2024
1 parent 1f1722b commit f7720de
Show file tree
Hide file tree
Showing 11 changed files with 911 additions and 61 deletions.
651 changes: 650 additions & 1 deletion package-lock.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,26 @@
},
"devDependencies": {
"@amsterdam/design-system-react": "0.13.0",
"@nl-design-system-community/purmerend-design-tokens": "file:../../nl-design-system/themes-bryan/proprietary/purmerend-design-tokens",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.6.2",
"@testing-library/react": "16.0.1",
"@types/node": "20",
"@types/react": "18",
"@types/react-dom": "18",
"@types/validator": "13.12.2",
"@utrecht/body-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/body-react",
"@utrecht/checkbox-group-react": "1.0.0",
"@utrecht/component-library-css": "6.1.0",
"@utrecht/component-library-react": "7.2.0",
"@utrecht/design-tokens": "2.1.1",
"@utrecht/nav-bar-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/nav-bar-react",
"@utrecht/page-body-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/page-body-react",
"@utrecht/page-footer-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/page-footer-react",
"@utrecht/page-header-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/page-header-react",
"@utrecht/page-layout-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/page-layout-react",
"@utrecht/radio-group-react": "1.0.3",
"@utrecht/root-react": "file:../../nl-design-system/utrecht-clean/packages/components-react/root-react",
"@utrecht/select-combobox-react": "1.0.1",
"@vitejs/plugin-react": "4.3.3",
"autoprefixer": "10.4.20",
Expand Down
168 changes: 168 additions & 0 deletions public/assets/purmerend-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 19 additions & 13 deletions src/app/[locale]/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Navigation } from '@/app/[locale]/components/Navigation'
import { Link, Logo } from '@/components/index'
import { Link, Logo, PageHeader } from '@/components/index'
import Image from 'next/image'

export interface HeaderProps {
Expand All @@ -21,19 +21,25 @@ const Header = ({ homepage, logo }: HeaderProps) => {
)

return (
<header>
{homepage ? (
<Link boxContent href={homepage.href} aria-labelledby="logo-link-label">
<span id="logo-link-label" hidden>
{homepage.label}
</span>
{logoElement}
</Link>
) : (
logoElement
)}
<>
<PageHeader>
{homepage ? (
<Link
boxContent
href={homepage.href}
aria-labelledby="logo-link-label"
>
<span id="logo-link-label" hidden>
{homepage.label}
</span>
{logoElement}
</Link>
) : (
logoElement
)}
</PageHeader>
<Navigation />
</header>
</>
)
}

Expand Down
17 changes: 8 additions & 9 deletions src/app/[locale]/components/LanguageSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useTransition } from 'react'
import { ChangeEvent, useTransition } from 'react'
import { usePathname, useRouter } from '@/routing/navigation'
import { Select } from '@/components'
import { getAllAvailableLocales } from '@/lib/utils/locale'
Expand All @@ -13,19 +13,18 @@ const LanguageSwitch = () => {
const pathname = usePathname()
const [isPending, startTransition] = useTransition()

const onSelectChange = (locale: string) => {
const onSelectChange = (evt: ChangeEvent<HTMLSelectElement>) => {
startTransition(() => {
router.replace(pathname, { locale: locale })
router.replace(pathname, { locale: evt.target.value })
})
}

return (
<Select
value={locale}
values={getAllAvailableLocales()}
onSelectChange={onSelectChange}
disabled={isPending}
/>
<Select value={locale} onChange={onSelectChange} disabled={isPending}>
{getAllAvailableLocales().map((lang, index) => (
<option key={index}>{lang}</option>
))}
</Select>
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/app/[locale]/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { LanguageSwitch } from '@/app/[locale]/components/LanguageSwitch'
import { NavBar } from '@/components'

const Navigation = () => {
return (
<nav className="flex justify-end bg-gray-200 py-4 px-8">
<NavBar>
<LanguageSwitch />
</nav>
</NavBar>
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/[locale]/incident/add/components/MapDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const MapDialog = ({ trigger }: MapDialogProps) => {
<Dialog.Trigger asChild>{trigger}</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Overlay />
<Dialog.Content className="fixed inset-0 bg-white z-[1000] grid grid-cols-1 md:grid-cols-3 utrecht-theme">
<Dialog.Content className="fixed inset-0 bg-white z-[1000] grid grid-cols-1 md:grid-cols-3 purmerend-theme">
<VisuallyHidden.Root>
{/* TODO: Overleggen welke titel hier het meest vriendelijk is voor de gebruiker, multi-language support integreren */}
<Dialog.Title>{t('dialog_title')}</Dialog.Title>
Expand Down
16 changes: 7 additions & 9 deletions src/app/[locale]/incident/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ export default function IncidentLayout({ children }: Layout) {
const messages = useMessages()

return (
<main className="p-8">
<div className="max-w-3xl mx-auto gap-16 flex flex-col">
<div className="">
<NextIntlClientProvider messages={pick(messages, 'stepper')}>
<FormProgress />
</NextIntlClientProvider>
</div>
<NextIntlClientProvider messages={messages}>
<div className="col-span-1 md:col-span-8">{children}</div>
<main>
<div className="">
<NextIntlClientProvider messages={pick(messages, 'stepper')}>
<FormProgress />
</NextIntlClientProvider>
</div>
<NextIntlClientProvider messages={messages}>
<div className="col-span-1 md:col-span-8">{children}</div>
</NextIntlClientProvider>
</main>
)
}
58 changes: 34 additions & 24 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { notFound } from 'next/navigation'
import React from 'react'
import { getAllAvailableLocales } from '@/lib/utils/locale'
import { Container } from '@/components'
import {
Root,
PageLayout,
Body,
PageBody,
PageFooter,
Article,
} from '@/components'
import { Header } from '@/app/[locale]/components/Header'
import localFont from 'next/font/local'
import AppProvider from '@/components/providers/AppProvider'
import { Document } from '@utrecht/component-library-react/dist/css-module'
import { useTranslations } from 'next-intl'
import type { PropsWithChildren } from 'react'

const font = localFont({
src: '../../../public/fonts/open-sans.woff2',
Expand All @@ -17,34 +24,37 @@ const font = localFont({
export default function LocaleLayout({
children,
params: { locale },
}: {
children: React.ReactNode
}: PropsWithChildren<{
params: { locale: any }
}) {
}>) {
if (!getAllAvailableLocales().includes(locale as any)) notFound()
const t = useTranslations('current-organisation')

return (
<html lang={locale} className={`${font.variable}`}>
<body className="bg-gray-100">
<Root
lang={locale}
className={`${font.variable} purmerend-theme purmerend-theme--media-query`}
>
<Body>
<AppProvider>
<Document className="utrecht-theme">
<Container className="bg-white">
<Header
homepage={{
href: '/',
label: t('homepage-label'),
}}
logo={{
src: '/assets/utrecht.webp',
label: t('logo-label'),
}}
/>
{children}
</Container>
</Document>
<PageLayout>
<Header
homepage={{
href: '/',
label: t('homepage-label'),
}}
logo={{
src: '/assets/purmerend-logo.svg',
label: t('logo-label'),
}}
/>
<PageBody>
<Article>{children}</Article>
</PageBody>
<PageFooter>kthxbye</PageFooter>
</PageLayout>
</AppProvider>
</body>
</html>
</Body>
</Root>
)
}
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import './globals.css'
import '@utrecht/design-tokens/dist/index.css'
import '@nl-design-system-community/purmerend-design-tokens/dist/index.css'
import '@nl-design-system-community/purmerend-design-tokens/src/font.js'

const inter = Inter({ subsets: ['latin'] })

Expand Down
13 changes: 11 additions & 2 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export type * from '@utrecht/component-library-react/dist/css-module'
import { Select } from '@/components/ui'
import { Container } from '@/components/layout'

export { Select, Container }
export { Container }

export {
Alert,
Expand All @@ -28,8 +27,18 @@ export {
RadioButton,
LinkButton,
AlertDialog,
Article,
Select,
} from '@utrecht/component-library-react/dist/css-module'

export { RadioGroup } from '@utrecht/radio-group-react'
export { CheckboxGroup } from '@utrecht/checkbox-group-react'
export { Root } from '@utrecht/root-react/dist/css'
export { Body } from '@utrecht/body-react/dist/css'
export { PageLayout } from '@utrecht/page-layout-react/dist/css'
export { PageHeader } from '@utrecht/page-header-react/dist/css'
export { PageFooter } from '@utrecht/page-footer-react/dist/css'
export { PageBody } from '@utrecht/page-body-react/dist/css'
export { NavBar } from '@utrecht/nav-bar-react/dist/css'

// export { SelectCombobox } from '@/components/ui/SelectCombobox'

0 comments on commit f7720de

Please sign in to comment.