Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import type {
NavbarButtonProps,
NavItemProps,
} from "@lifesg/react-design-system/navbar";

export const navItems: NavItemProps<undefined>[] = [
{
id: "home",
children: "Home",
href: "https://www.life.gov.sg",
},
{
id: "guides",
children: "Guides",
href: "https://www.life.gov.sg",
},
{
id: "lifesg-app",
children: "LifeSG app",
href: "https://www.life.gov.sg",
},
];

export const downloadActionButtons: NavbarButtonProps[] = [
{ type: "download" },
];

export const navItemsWithSubmenu: NavItemProps<undefined>[] = [
{
id: "home",
children: "Home",
href: "https://www.life.gov.sg",
},
{
id: "services",
children: "Services",
href: "https://www.life.gov.sg/?section=services-and-tools",
subMenu: [
{
id: "services-getting-started",
children: "Birth registration",
href: "https://www.life.gov.sg",
},
{
id: "services-baby-bonus",
children: "Baby bonus",
href: "https://www.life.gov.sg",
},
{
id: "services-preschool-search",
children: "Preschool search",
href: "https://www.life.gov.sg",
},
],
},
{
id: "lifesg-app",
children: "LifeSG app",
href: "https://www.life.gov.sg",
},
];
16 changes: 16 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/compress.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-compressed"
compress
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to custom-action-button. the key here is to test the custom component support, avatar is only an example on how the navbar can be used

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems } from "./common";
import { Avatar } from "@lifesg/react-design-system/avatar";

export default function Story() {
return (
<Navbar
data-testid="navbar-with-avatar"
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{
desktop: [
{
type: "component",
args: { render: <Avatar>GovTech</Avatar> },
uncollapsible: true,
},
],
}}
/>
);
}
15 changes: 15 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/default.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-default"
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
16 changes: 16 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/hide-branding.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-hide-branding"
hideNavBranding
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-hide-link-indicator"
hideLinkIndicator
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-multiple-action-buttons"
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{
desktop: [
{ type: "download" },
{
type: "button",
args: { children: "Sign up", styleType: "secondary" },
},
{
type: "button",
args: { children: "Log in" },
},
],
}}
/>
);
}
16 changes: 16 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/no-masthead.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-no-masthead"
masthead={false}
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
21 changes: 21 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/secondary-brand.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-secondary-brand"
selectedId="guides"
resources={{
secondary: {
brandName: "BookingSG",
logoSrc: "https://www.booking.gov.sg/logo.svg",
},
}}
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";

export default function Story() {
return (
<Navbar
actionButtons={{
desktop: [
{
args: {
children: "Logout",
styleType: "secondary",
},
type: "button",
},
],
}}
items={{
desktop: [],
mobile: [],
}}
selectedId="home"
/>
);
}
16 changes: 16 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/stretch.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { navItems, downloadActionButtons } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-stretch"
layout="stretch"
selectedId="guides"
items={{ desktop: navItems }}
actionButtons={{ desktop: downloadActionButtons }}
/>
);
}
16 changes: 16 additions & 0 deletions e2e/nextjs-app/src/app/components/navbar/submenu.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { Navbar } from "@lifesg/react-design-system/navbar";
import { downloadActionButtons, navItemsWithSubmenu } from "./common";

export default function Story() {
return (
<Navbar
data-testid="navbar-submenu"
items={{ desktop: navItemsWithSubmenu }}
actionButtons={{ desktop: downloadActionButtons }}
onItemClick={() => {}}
selectedId="services"
/>
);
}
5 changes: 2 additions & 3 deletions e2e/nextjs-app/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ export function proxy(request: NextRequest) {
isDev ? "'unsafe-eval'" : ""
} https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@3/components/Masthead/index.umd.js;
${styleSrcDirective}
img-src 'self' https://assets.life.gov.sg
https://mylegacy.life.gov.sg https://home.booking.gov.sg blob: data:;
font-src 'self';
img-src 'self' https://*.life.gov.sg https://*.booking.gov.sg blob: data:;
font-src 'self' https://assets.life.gov.sg;
object-src 'none';
base-uri 'self';
form-action 'self';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading