Skip to content

Commit ac554e5

Browse files
Enable view transitions
1 parent 1a78dc0 commit ac554e5

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

next.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import './src/env.mjs';
33
/**@type {import('next').NextConfig}*/
44
const config = {
55
reactStrictMode: true,
6+
experimental: {
7+
viewTransition: true
8+
},
69
async redirects() {
710
return [
811
{

src/app/layout.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import '@/styles/globals.css';
22
import Script from 'next/script';
33
import type { Metadata, Viewport } from 'next';
44
import { Space_Grotesk } from 'next/font/google';
5+
import { unstable_ViewTransition as ViewTransition } from 'react';
56
import { Toaster } from 'react-hot-toast';
67
import { SessionProvider } from 'next-auth/react';
78
import { Footer } from '@/components/footer';
@@ -19,19 +20,21 @@ export default function RootLayout({ children }: React.PropsWithChildren) {
1920
return (
2021
<html className={spaceGrotesk.variable}>
2122
<body className="font-sans font-normal bg-hacktoberfest-dark-green">
22-
{children}
23-
<Footer />
24-
<SessionProvider>
25-
<ReportModal />
26-
</SessionProvider>
27-
<Toaster position="bottom-right" />
28-
{env.NEXT_PUBLIC_ANALYTICS_WEBSITE_ID && (
29-
<Script
30-
src="https://cloud.umami.is/script.js"
31-
data-website-id={env.NEXT_PUBLIC_ANALYTICS_WEBSITE_ID}
32-
strategy="lazyOnload"
33-
/>
34-
)}
23+
<ViewTransition>
24+
{children}
25+
<Footer />
26+
<SessionProvider>
27+
<ReportModal />
28+
</SessionProvider>
29+
<Toaster position="bottom-right" />
30+
{env.NEXT_PUBLIC_ANALYTICS_WEBSITE_ID && (
31+
<Script
32+
src="https://cloud.umami.is/script.js"
33+
data-website-id={env.NEXT_PUBLIC_ANALYTICS_WEBSITE_ID}
34+
strategy="lazyOnload"
35+
/>
36+
)}
37+
</ViewTransition>
3538
</body>
3639
</html>
3740
);

0 commit comments

Comments
 (0)