Skip to content

Commit

Permalink
fix: next nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jh123x committed Jan 7, 2025
1 parent be2176b commit 9e4e5d2
Show file tree
Hide file tree
Showing 10 changed files with 279 additions and 129 deletions.
277 changes: 252 additions & 25 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/cache": "^11.14.0",
"@emotion/react": "^11.11.4",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.18",
"@mui/material": "^5.15.18",
"@mui/material-nextjs": "^6.3.1",
"file-loader": "^6.2.0",
"next": "^15.1.3",
"react": "^18.3.1",
Expand Down
10 changes: 0 additions & 10 deletions src/App.test.tsx

This file was deleted.

82 changes: 0 additions & 82 deletions src/App.tsx

This file was deleted.

6 changes: 4 additions & 2 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Brightness4, Menu as MenuIcon } from "@mui/icons-material";
import { Switch, IconButton } from "@mui/material";
import Sidebar from "src/Components/Sidebar";

export const App = ({ children }: { children: React.ReactNode }) => {
const Nav = ({ children }: { children: React.ReactNode }) => {
const [navToggle, setNavToggle] = React.useState(false);
const [isDarkMode, setIsDarkMode] = React.useState(false);

Expand Down Expand Up @@ -42,4 +42,6 @@ export const App = ({ children }: { children: React.ReactNode }) => {
{children}
</div>
);
};
};

export default Nav;
4 changes: 4 additions & 0 deletions src/app/client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use client';
import dynamic from 'next/dynamic'

export const NoSSRNav = dynamic(() => import('./app'), { ssr: false })
22 changes: 13 additions & 9 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import * as React from 'react'
import { AppRouterCacheProvider } from '@mui/material-nextjs/v15-appRouter';
import { Metadata } from 'next'
import { App } from 'src/app/app';
import GlobalStyle from 'src/styles/GlobalStyle'
import { NoSSRNav } from './client'

export const metadata: Metadata = {
title: 'Wen Junhua',
description: 'Jh123x Portfolio Website',
manifest: '/manifest.json',
}

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
export default function RootLayout({ children, }: { children: React.ReactNode }) {
return (
<html lang="en">
<GlobalStyle />
<body>
<App children={children} />
<GlobalStyle />
<AppRouterCacheProvider
options={{
key: 'css',
enableCssLayer: true,
}}
>
<NoSSRNav children={children} />
</AppRouterCacheProvider>
</body>
</html>
)
}
}
1 change: 1 addition & 0 deletions src/app/portfolio/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import * as React from "react";
import { MainLayout, InnerLayout } from "../../styles/Layouts";
import Title from "../../Components/Title";
Expand Down
2 changes: 1 addition & 1 deletion src/app/resume/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client";
'use client';
import * as React from "react";
import Skills from "../../Components/Skills";
import Resume from "../../Components/Resume";
Expand Down
1 change: 1 addition & 0 deletions src/styles/Layouts.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import styled from "styled-components";

export const MainLayout = styled.div`
Expand Down

0 comments on commit 9e4e5d2

Please # to comment.