-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
54 changed files
with
622 additions
and
502 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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export async function GET() { | ||
return Response.json({ message: "Health check successful." }); | ||
return Response.json({ message: 'Health check successful.' }); | ||
} |
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import { MainMenuItem } from "./main-menu"; | ||
import { MainMenuItem } from './main-menu'; | ||
|
||
export const mainMenuItems: Omit<MainMenuItem, "isActive">[] = [ | ||
export const mainMenuItems: Omit<MainMenuItem, 'isActive'>[] = [ | ||
{ | ||
id: "get-started", | ||
name: "Get started", | ||
href: "/get-started/", | ||
id: 'get-started', | ||
name: 'Get started', | ||
href: '/get-started/', | ||
}, | ||
{ | ||
id: "foundations", | ||
name: "Foundations", | ||
href: "/foundations/", | ||
id: 'foundations', | ||
name: 'Foundations', | ||
href: '/foundations/', | ||
}, | ||
{ | ||
id: "components", | ||
name: "Components", | ||
href: "/components/", | ||
id: 'components', | ||
name: 'Components', | ||
href: '/components/', | ||
}, | ||
{ | ||
id: "patterns", | ||
name: "Patterns", | ||
href: "/patterns/", | ||
id: 'patterns', | ||
name: 'Patterns', | ||
href: '/patterns/', | ||
}, | ||
{ | ||
id: "resources", | ||
name: "Resources", | ||
href: "/resources/", | ||
id: 'resources', | ||
name: 'Resources', | ||
href: '/resources/', | ||
}, | ||
]; |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { usePathname } from "next/navigation"; | ||
import { mainMenuItems } from "./menu-items"; | ||
import { usePathname } from 'next/navigation'; | ||
import { mainMenuItems } from './menu-items'; | ||
|
||
export function useMainMenuItems() { | ||
const pathname = usePathname(); | ||
|
||
// TODO: review showing main menu on the home page | ||
if (pathname === "/") { | ||
if (pathname === '/') { | ||
return []; | ||
} | ||
|
||
return mainMenuItems.map((item) => { | ||
const pathnameParts = pathname.split("/").filter(Boolean); | ||
const pathnameParts = pathname.split('/').filter(Boolean); | ||
return { ...item, isActive: item.href === `/${pathnameParts[0]}/` }; | ||
}); | ||
} |
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
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export const config = { | ||
isProduction: process.env.NODE_ENV === "production", | ||
buildingBlocksHomeUrl: "https://dev.blocks.gov.ie/en/", | ||
isProduction: process.env.NODE_ENV === 'production', | ||
buildingBlocksHomeUrl: 'https://dev.blocks.gov.ie/en/', | ||
feedbackFormUrl: | ||
"https://www.formsg.testing.gov.ie/en/664c61ba5f7c9800231db294", | ||
'https://www.formsg.testing.gov.ie/en/664c61ba5f7c9800231db294', | ||
signUpFormUrl: | ||
"https://www.formsg.testing.gov.ie/en/664b6de45f7c9800231daf22", | ||
'https://www.formsg.testing.gov.ie/en/664b6de45f7c9800231daf22', | ||
}; |
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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
import { getDocumentDetails } from "./document-details"; | ||
import { getDocumentDetails } from './document-details'; | ||
|
||
describe("getDocumentDetails", () => { | ||
it("should throw for missing path", () => { | ||
expect(() => getDocumentDetails("")).toThrowError(`Invalid path ''.`); | ||
describe('getDocumentDetails', () => { | ||
it('should throw for missing path', () => { | ||
expect(() => getDocumentDetails('')).toThrowError(`Invalid path ''.`); | ||
}); | ||
|
||
it("should return all parts in slug for 2 segments", () => { | ||
expect(getDocumentDetails("1-foo/2-bar")).toEqual({ | ||
id: "1-foo/2-bar", | ||
it('should return all parts in slug for 2 segments', () => { | ||
expect(getDocumentDetails('1-foo/2-bar')).toEqual({ | ||
id: '1-foo/2-bar', | ||
order: 2, | ||
slug: "foo/bar", | ||
slug: 'foo/bar', | ||
}); | ||
}); | ||
|
||
it("should skip section in slug for 3 segments", () => { | ||
expect(getDocumentDetails("1-foo/2-bar/3-baz")).toEqual({ | ||
id: "1-foo/2-bar/3-baz", | ||
it('should skip section in slug for 3 segments', () => { | ||
expect(getDocumentDetails('1-foo/2-bar/3-baz')).toEqual({ | ||
id: '1-foo/2-bar/3-baz', | ||
order: 3, | ||
slug: "foo/baz", | ||
slug: 'foo/baz', | ||
}); | ||
}); | ||
|
||
it("should throw for one part", () => { | ||
expect(() => getDocumentDetails("1-foo")).toThrowError( | ||
`Invalid path '1-foo'.` | ||
it('should throw for one part', () => { | ||
expect(() => getDocumentDetails('1-foo')).toThrowError( | ||
`Invalid path '1-foo'.`, | ||
); | ||
}); | ||
|
||
it("should throw for more than 3 parts", () => { | ||
expect(() => getDocumentDetails("1-foo/2-bar/3-baz/4-qux")).toThrowError( | ||
`Invalid path '1-foo/2-bar/3-baz/4-qux'.` | ||
it('should throw for more than 3 parts', () => { | ||
expect(() => getDocumentDetails('1-foo/2-bar/3-baz/4-qux')).toThrowError( | ||
`Invalid path '1-foo/2-bar/3-baz/4-qux'.`, | ||
); | ||
}); | ||
|
||
it("should throw for missing order", () => { | ||
expect(() => getDocumentDetails("foo/2-bar")).toThrowError( | ||
`Invalid segment 'foo'.` | ||
it('should throw for missing order', () => { | ||
expect(() => getDocumentDetails('foo/2-bar')).toThrowError( | ||
`Invalid segment 'foo'.`, | ||
); | ||
}); | ||
}); |
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
Oops, something went wrong.