Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add next-example #616

Merged
merged 3 commits into from
Nov 10, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/change-assurance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
app: [ 'docs' ]
app: [ 'docs', 'next-example' ]
steps:

- name: Check out repository
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
app: [ 'docs' ]
app: [ 'docs', 'next-example' ]
browser: [ 'chromium', 'firefox', 'electron' ]
steps:

Expand Down
5 changes: 4 additions & 1 deletion apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "../../tsconfig.webpack.json"
"extends": "../../tsconfig.webpack.json",
"include": [
"src"
]
}
47 changes: 47 additions & 0 deletions apps/next-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# NotGovUK extras
.cypress/
.netlify/
.serverless/
dist/
node_modules/
package-lock.json
pkg/
pnpm-lock.yaml
tsconfig.tsbuildinfo
36 changes: 36 additions & 0 deletions apps/next-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
10 changes: 10 additions & 0 deletions apps/next-example/cypress.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'cypress';
import projectConfig from '../../cypress.config.mjs';

export default defineConfig({
...projectConfig,
e2e: {
...projectConfig.e2e,
baseUrl: 'http://localhost:3000'
}
});
9 changes: 9 additions & 0 deletions apps/next-example/feat/home.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('The home page', () => {
it('successfully loads', () => {
cy.visit('/');
});

it('is the correct page', () => {
cy.contains('My page');
});
});
15 changes: 15 additions & 0 deletions apps/next-example/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const baseConfig = require('../../jest.config.base');

const config = {
...baseConfig,
collectCoverageFrom: [
'<rootDir>/src/**.{ts,tsx}',
],
testMatch: [
'<rootDir>/spec/**.{ts,tsx}'
]
};

module.exports = config;
20 changes: 20 additions & 0 deletions apps/next-example/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import webpack from 'webpack';

/** @type {import('next').NextConfig} */
const nextConfig = {
// This allows us to handle next-example, the same way we do standard apps, in CI
distDir: 'dist',
// Prevent react-router from resolving in order to use Next's router instead.
// Normally users will not need to do this, as they will not have react-router installed.
webpack: (config, _options) => ({
...config,
plugins: [
...config.plugins,
new webpack.NormalModuleReplacementPlugin(/^react-helmet-async$/, '@not-govuk\/VOID-react-helmet-async'),
new webpack.NormalModuleReplacementPlugin(/^react-router$/, '@not-govuk\/VOID-react-router'),
new webpack.NormalModuleReplacementPlugin(/^react-router-dom$/, '@not-govuk\/VOID-react-router-dom'),
]
})
};

export default nextConfig;
37 changes: 37 additions & 0 deletions apps/next-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@hods/next-example",
"version": "0.4.0",
"description": "A Next.js application with HODS components.",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "npm run test:unit",
"test:ci": "npm test && npm run test:functional:ci",
"test:functional": "cypress run ${CYPRESS_PROJECT_ID:+--record ${CYPRESS_FLAGS}}",
"test:functional:ci": "start-server-and-test 'start' 'http-get://localhost:3000/' test:functional",
"test:unit": "jest --passWithNoTests",
"clean": "rm -rf dist"
},
"dependencies": {
"@not-govuk/simple-components": "^0.15.0",
"@hods/components": "workspace:^0.4.0",
"next": "15.0.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "22.9.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"cypress": "13.15.2",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"sass": "^1.80.6",
"start-server-and-test": "2.0.8",
"ts-jest": "29.2.5",
"typescript": "^5"
}
}
1 change: 1 addition & 0 deletions apps/next-example/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/next-example/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/next-example/src/app/favicon.ico
Binary file not shown.
10 changes: 10 additions & 0 deletions apps/next-example/src/app/feedback/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default function Page() {
return (
<>
<h1>
Feedback
</h1>
<p>Page for feedback form</p>
</>
);
}
10 changes: 10 additions & 0 deletions apps/next-example/src/app/four/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default function Page() {
return (
<>
<h1>
Four
</h1>
<p>Four content</p>
</>
);
}
107 changes: 107 additions & 0 deletions apps/next-example/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
:root {
--max-width: 1100px;
--border-radius: 12px;
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
"Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
"Fira Mono", "Droid Sans Mono", "Courier New", monospace;

--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;

--primary-glow: conic-gradient(
from 180deg at 50% 50%,
#16abff33 0deg,
#0885ff33 55deg,
#54d6ff33 120deg,
#0071ff33 160deg,
transparent 360deg
);
--secondary-glow: radial-gradient(
rgba(255, 255, 255, 1),
rgba(255, 255, 255, 0)
);

--tile-start-rgb: 239, 245, 249;
--tile-end-rgb: 228, 232, 233;
--tile-border: conic-gradient(
#00000080,
#00000040,
#00000030,
#00000020,
#00000010,
#00000010,
#00000080
);

--callout-rgb: 238, 240, 241;
--callout-border-rgb: 172, 175, 176;
--card-rgb: 180, 185, 188;
--card-border-rgb: 131, 134, 135;
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;

--primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0));
--secondary-glow: linear-gradient(
to bottom right,
rgba(1, 65, 255, 0),
rgba(1, 65, 255, 0),
rgba(1, 65, 255, 0.3)
);

--tile-start-rgb: 2, 13, 46;
--tile-end-rgb: 2, 5, 19;
--tile-border: conic-gradient(
#ffffff80,
#ffffff40,
#ffffff30,
#ffffff20,
#ffffff10,
#ffffff10,
#ffffff80
);

--callout-rgb: 20, 20, 20;
--callout-border-rgb: 108, 108, 108;
--card-rgb: 100, 100, 100;
--card-border-rgb: 200, 200, 200;
}
}

* {
box-sizing: border-box;
padding: 0;
margin: 0;
}

html,
body {
max-width: 100vw;
overflow-x: hidden;
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}

a {
color: inherit;
text-decoration: none;
}

@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}
50 changes: 50 additions & 0 deletions apps/next-example/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { Metadata } from "next";
import React from "react";
//import { Inter } from "next/font/google";
import { Page } from '@hods/components';
/* import "./globals.css"; */

//const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>
<Page
navigation={[
{
href: "/one",
text: "One"
},
{
href: "/one/two",
text: "Two"
},
{
href: "/three",
text: "Three"
},
{
href: "/four",
text: "Four"
}
]}
serviceName="Next.js App"
serviceHref="/"
title="HODS"
>
{children}
</Page>
</body>
</html>
);
}
Loading
Loading