Skip to content

Commit

Permalink
feat: add next-view-transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
hendraaagil committed May 30, 2024
1 parent 1a2bd58 commit 45ef0d1
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 35 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"next": "14.2.3",
"next-contentlayer": "^0.3.4",
"next-themes": "^0.3.0",
"next-view-transitions": "^0.2.0",
"plaiceholder": "^3.0.0",
"react": "^18.3.1",
"react-countup": "^6.5.3",
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 33 additions & 30 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Gabarito as FontSans,
JetBrains_Mono as FontMono,
} from 'next/font/google'
import { ViewTransitions } from 'next-view-transitions'
import { generateSeoMeta } from '@/lib/seo'
import { cn } from '@/lib/utils'

Expand Down Expand Up @@ -40,35 +41,37 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<html lang="en" suppressHydrationWarning>
<head />
<body
className={cn(
'min-h-screen overflow-y-scroll font-sans antialiased bg-color text-color',
fontSans.variable,
fontMono.variable,
)}
>
<main className="mx-auto flex max-w-5xl">
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem
disableTransitionOnChange
>
<Navigation />
{children}
</ThemeProvider>
</main>
{process.env.NODE_ENV === 'production' && (
<Script
data-website-id="d7044884-6f55-4a16-8344-9221c0e82832"
src="https://analytics.hendraaagil.dev/script.js"
async
defer
/>
)}
</body>
</html>
<ViewTransitions>
<html lang="en" suppressHydrationWarning>
<head />
<body
className={cn(
'min-h-screen overflow-y-scroll font-sans antialiased bg-color text-color',
fontSans.variable,
fontMono.variable,
)}
>
<main className="mx-auto flex max-w-5xl">
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem
disableTransitionOnChange
>
<Navigation />
{children}
</ThemeProvider>
</main>
{process.env.NODE_ENV === 'production' && (
<Script
data-website-id="d7044884-6f55-4a16-8344-9221c0e82832"
src="https://analytics.hendraaagil.dev/script.js"
async
defer
/>
)}
</body>
</html>
</ViewTransitions>
)
}
2 changes: 1 addition & 1 deletion src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from 'next/link'
import { Link } from 'next-view-transitions'
import { Heading } from '@/components/ui'
import { PageContainer } from '@/components/layout'

Expand Down
2 changes: 1 addition & 1 deletion src/components/blog/card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Post } from 'contentlayer/generated'

import Link from 'next/link'
import { Link } from 'next-view-transitions'
import { ChevronRight } from 'lucide-react'

import { Heading, ImageBlur, headingVariants } from '@/components/ui'
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/section-container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Link from 'next/link'
import { Link } from 'next-view-transitions'
import { ChevronRight } from 'lucide-react'

import { Heading } from '@/components/ui'
Expand Down
4 changes: 3 additions & 1 deletion src/components/layout/navigation/link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { LinkProps } from 'next/link'

import React from 'react'
import Link, { type LinkProps } from 'next/link'
import { Link } from 'next-view-transitions'

import { cn } from '@/lib/utils'

Expand Down
2 changes: 1 addition & 1 deletion src/components/project/card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Project } from 'contentlayer/generated'

import Link from 'next/link'
import { Link } from 'next-view-transitions'
import { ChevronRight } from 'lucide-react'
import { Heading, ImageBlur, headingVariants } from '@/components/ui'

Expand Down

0 comments on commit 45ef0d1

Please sign in to comment.