Skip to content

Commit

Permalink
Merge pull request dev-next-release - 1.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bapmrl authored Oct 12, 2023
2 parents 8a68d99 + b353a1f commit 16f33a5
Show file tree
Hide file tree
Showing 86 changed files with 4,424 additions and 629 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/slices/00-create.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ describe("Create Slices", () => {

cy.location("pathname", { timeout: 20000 }).should(
"eq",
`/${lib}/${sliceName}/bar`
`/slices/${lib}/${sliceName}/bar`
);
cy.get("button").contains("foo").click();
cy.contains("Default").click();
cy.location("pathname", { timeout: 20000 }).should(
"eq",
`/${lib}/${sliceName}/default`
`/slices/${lib}/${sliceName}/default`
);

cy.contains("Save").click();
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/updates/simulator-tooltip.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("simulator tooltip", () => {

cy.createSlice(lib, sliceId, sliceName);

cy.visit(`/${lib}/${sliceName}/default`);
cy.visit(`/slices/${lib}/${sliceName}/default`);

// There is a 5 s timeout for displaying the tooltip.
cy.wait(6_000);
Expand All @@ -37,7 +37,7 @@ describe("simulator tooltip", () => {

cy.createSlice(lib, sliceId, sliceName);

cy.visit(`/${lib}/${sliceName}/default`);
cy.visit(`/slices/${lib}/${sliceName}/default`);

// There is a 5 s timeout for displaying the tooltip.
cy.wait(6_000);
Expand All @@ -50,7 +50,7 @@ describe("simulator tooltip", () => {

cy.createSlice(lib, sliceId, sliceName);

cy.visit(`/${lib}/${sliceName}/default`);
cy.visit(`/slices/${lib}/${sliceName}/default`);

// There is a 5 s timeout for displaying the tooltip.
cy.wait(6_000);
Expand Down
2 changes: 1 addition & 1 deletion cypress/helpers/slices.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function createSlice(lib, id, name) {

cy.location("pathname", { timeout: 20000 }).should(
"eq",
`/${lib}/${name}/default`
`/slices/${lib}/${name}/default`
);
cy.readFile(TYPES_FILE).should("contains", name);
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/pages/slices/sliceBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SliceBuilder extends BaseBuilder {
}

goTo(sliceLibrary, sliceName, variation = "default") {
cy.visit(`/${sliceLibrary}/${sliceName}/${variation}`);
cy.visit(`/slices/${sliceLibrary}/${sliceName}/${variation}`);
this.saveButton.should("be.visible");
cy.contains(sliceName).should("be.visible");
return this;
Expand Down
34 changes: 34 additions & 0 deletions e2e-projects/next-upgrade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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
```

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.
5 changes: 5 additions & 0 deletions e2e-projects/next-upgrade/app/api/exit-preview/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { exitPreview } from "@prismicio/next";

export async function GET(): Promise<void | Response> {
return await exitPreview();
}
13 changes: 13 additions & 0 deletions e2e-projects/next-upgrade/app/api/preview/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { redirectToPreviewURL } from "@prismicio/next";
import { draftMode } from "next/headers";
import { NextRequest } from "next/server";

import { createClient } from "../../../prismicio";

export async function GET(request: NextRequest): Promise<void> {
const client = createClient();

draftMode().enable();

await redirectToPreviewURL({ client, request });
}
8 changes: 8 additions & 0 deletions e2e-projects/next-upgrade/app/api/revalidate/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { revalidateTag } from "next/cache";
import { NextResponse } from "next/server";

export async function POST(): Promise<Response> {
revalidateTag("prismic");

return NextResponse.json({ revalidated: true, now: Date.now() });
}
22 changes: 22 additions & 0 deletions e2e-projects/next-upgrade/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";

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

// eslint-disable-next-line react-refresh/only-export-components
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}): JSX.Element {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}
7 changes: 7 additions & 0 deletions e2e-projects/next-upgrade/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Home(): JSX.Element {
return (
<main>
home
</main>
);
}
14 changes: 14 additions & 0 deletions e2e-projects/next-upgrade/app/slice-simulator/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use client";

import { SliceZone } from "@prismicio/react";
import { SliceSimulator } from "@slicemachine/adapter-next/simulator";

import { components } from "../../slices";

export default function SliceSimulatorPage(): JSX.Element {
return (
<SliceSimulator
sliceZone={(props) => <SliceZone {...props} components={components} />}
/>
);
}
123 changes: 123 additions & 0 deletions e2e-projects/next-upgrade/customtypes/kitchen_sink/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"id": "kitchen_sink",
"label": "Kitchen Sink",
"repeatable": true,
"json": {
"Main": {
"body": {
"type": "Slices",
"fieldset": "Slice zone",
"config": {
"labels": null,
"choices": {
"legacy_cta": {
"type": "Link",
"config": {
"allowTargetBlank": true,
"label": "CTA Link",
"select": null
}
},
"quiet_cta": {
"type": "Slice",
"fieldset": "Quiet CTA",
"description": "Quiet CTA",
"icon": "account_balance",
"display": "list",
"non-repeat": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Title"
}
},
"cta_label": {
"type": "Text",
"config": {
"label": "CTA Label"
}
},
"cta_link": {
"type": "Link",
"config": {
"allowTargetBlank": true,
"label": "CTA Link",
"select": null
}
}
},
"repeat": {}
},
"shouting_cta": {
"type": "Slice",
"fieldset": "Shouting CTA",
"description": "Shouting CTA",
"icon": "account_box",
"display": "list",
"non-repeat": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Title"
}
}
},
"repeat": {
"cta_label": {
"type": "Text",
"config": {
"label": "CTA Label"
}
},
"cta_link": {
"type": "Link",
"config": {
"allowTargetBlank": true,
"label": "CTA Link",
"select": null
}
}
}
},
"beautiful_cta": {
"type": "Slice",
"fieldset": "Beautiful CTA",
"description": "Beautiful CTA",
"icon": "adb",
"display": "grid",
"non-repeat": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Title"
}
}
},
"repeat": {
"cta_label": {
"type": "Text",
"config": {
"label": "CTA Label"
}
},
"cta_link": {
"type": "Link",
"config": {
"allowTargetBlank": true,
"label": "CTA Link",
"select": null
}
}
}
}
}
}
}
}
},
"status": true,
"format": "custom"
}
83 changes: 83 additions & 0 deletions e2e-projects/next-upgrade/customtypes/kitchen_sink_2/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"id": "kitchen_sink_2",
"label": "Kitchen Sink 2",
"repeatable": true,
"json": {
"Main": {
"body": {
"type": "Slices",
"fieldset": "Slice zone",
"config": {
"labels": null,
"choices": {
"legacy_cta": {
"type": "Link",
"config": {
"allowTargetBlank": true,
"label": "CTA Link",
"select": null
}
},
"quiet_cta": {
"type": "Slice",
"fieldset": "Quiet CTA",
"description": "Quiet CTA",
"icon": "account_balance",
"display": "list",
"non-repeat": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Title"
}
},
"cta_label": {
"type": "Text",
"config": {
"label": "CTA Label"
}
},
"cta_link": {
"type": "Link",
"config": {
"allowTargetBlank": true,
"label": "CTA Link",
"select": null
}
}
},
"repeat": {}
},
"shouting_cta": {
"type": "Slice",
"fieldset": "Shouting CTA",
"description": "Shouting CTA",
"icon": "account_box",
"display": "list",
"non-repeat": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Title"
}
}
},
"repeat": {
"cta_label": {
"type": "Text",
"config": {
"label": "CTA Label"
}
}
}
}
}
}
}
}
},
"status": true,
"format": "custom"
}
Loading

0 comments on commit 16f33a5

Please sign in to comment.