Skip to content

Commit

Permalink
- migrated to new next
Browse files Browse the repository at this point in the history
  • Loading branch information
andrecrjr committed Apr 19, 2024
1 parent eba4d32 commit 309a17c
Show file tree
Hide file tree
Showing 22 changed files with 265 additions and 250 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

62 changes: 62 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Metadata } from 'next'
import Script from 'next/script'
import { fontPrimaryTheme } from '@/styles/theme';
import StyledComponentsRegistry from '@/lib/registry';
import { GlobalThemeProvider } from '@/components/Contexts/ThemeProvider';

export const metadata: Metadata = {
title: 'ACJRHUB - Portfolio do Ac Junior',
description: `André Carlos Jr's Portfolio to maintain its portfolio projects and works in Front-end development!`,
robots: "index, follow"
}

export default function RootLayout({
// Layouts must accept a children prop.
// This will be populated with nested layouts or pages
children,
}: {
children: React.ReactNode
}) {

return (
<html lang="en">
<head>
<Script
strategy="afterInteractive"
async
src={'https://www.googletagmanager.com/gtag/js?id=G-YCSLXN1PVV'}
/>
<Script id="google-analytics" strategy="afterInteractive">
{process.env.NODE_ENV !== "development" && `
window.dataLayer = window.dataLayer || [];
function gtag(){
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-YCSLXN1PVV');
`}
</Script>
<link rel="preconnect"
href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossOrigin={''}
/>
<link href={`${fontPrimaryTheme.urlGoogleFont}`}
rel="stylesheet" />
{<meta
name="google-site-verification"
content="google504a726bb71d2ea2"
/>}
</head>
<body>
<StyledComponentsRegistry>
<GlobalThemeProvider>
{children}
</GlobalThemeProvider>
</StyledComponentsRegistry>
</body>
</html>
)
}
19 changes: 19 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Header from "@/components/Layout/Header";
import { AboutMe } from "@/components/Pages/AboutMe";
import { AboutMeContainer } from "@/components/Pages/AboutMe/About.style";
import MainPage from "@/components/Pages/MainPage";
import { Portfolio } from "@/components/Pages/Portfolio";
import { GlobalContainer } from "@/styles/global";

type Props = {};

export default function Page({}: Props) {
return (
<GlobalContainer>
<Header />
<MainPage />
<AboutMe />
<Portfolio />
</GlobalContainer>
);
}
51 changes: 51 additions & 0 deletions components/Contexts/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"use client"
import { theme } from "@/styles/theme";
import React, { useEffect } from "react";
import { ThemeProvider } from "styled-components";
import { createGlobalStyle } from "styled-components";
import Aos from 'aos';
import 'aos/dist/aos.css';

const GlobalStyle = createGlobalStyle`
*{
margin:0;
padding:0;
}
body{
font-family: ${(props) => props.theme.fontFamily};
}
a{
&:hover{
transition:transform 200ms linear;
}
opacity: 0.7;
transition: opacity 300ms ease-out;
&:hover{
opacity: 1;
}
&:visited{
color: ${(props) => props.theme.colors.primary}
}
}
`;

type Props = {
children: React.ReactNode
};

export const GlobalThemeProvider = ({children}: Props) => {


useEffect(() => {
Aos.init({ duration: 1500 });
}, []);

return (
<ThemeProvider theme={theme}>
<GlobalStyle />
{children}
</ThemeProvider>
);
};
7 changes: 6 additions & 1 deletion components/Layout/Header/Header.style.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

"use client"
import styled from 'styled-components';

export const MenuLink = styled.div`
Expand All @@ -19,7 +21,7 @@ export const GlobalHeader = styled.header`
align-items: center;
background-color: transparent;
border-bottom: 1px solid white;
height: ${(props) => props.theme.heights.menuHeight};
height: ${({theme}) => theme.heights.menuHeight};
color: ${(props) => props.theme.colors.primary};
position: absolute;
top: 0;
Expand All @@ -33,6 +35,9 @@ export const GlobalHeader = styled.header`
.header--menu {
display: flex;
}
a{
text-decoration: none;
}
@media (min-width: 767px) {
display: grid;
grid-template-columns: ${(props) => props.theme.gridHeader};
Expand Down
4 changes: 3 additions & 1 deletion components/Layout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Link from 'next/link';
const Header = () => {
return (
<GlobalHeader>
<Link href="/"><h1 className="header--logo">ACJRHUB</h1></Link>
<Link href="/">
<h1 className="header--logo">ACJRHUB</h1>
</Link>
<nav className="header--menu">
<Link href="#about-me">
<MenuLink>About Me</MenuLink>
Expand Down
1 change: 1 addition & 0 deletions components/Pages/AboutMe/About.style.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client"
import { Container, PresentationContainer } from '../styles';
import styled from 'styled-components';
import { Presentation } from '../styles';
Expand Down
1 change: 1 addition & 0 deletions components/Pages/AboutMe/Experience/Experience.style.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client"
import styled from "styled-components";


Expand Down
3 changes: 1 addition & 2 deletions components/Pages/MainPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { ReactElement } from 'react';
import { Container, Presentation, PresentationContainer } from '../styles';
import { SocialNetwork } from '../../Layout/SocialNetwork';
import { Stacks } from '../../Layout/Stacks';
import {
MyStackContainer,
PresentationPic,
SocialNetworkContainer
} from './style';
import { SocialNetwork } from '@/components/Layout/SocialNetwork';

export default function MainPage({}): ReactElement {
return (
Expand Down
1 change: 1 addition & 0 deletions components/Pages/MainPage/style.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client"
import styled from 'styled-components';

export const PresentationPic = styled.div<{ bgImage: string }>`
Expand Down
1 change: 1 addition & 0 deletions components/Pages/Portfolio/Portfolio.style.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client"
import styled from 'styled-components';
import { Container, Presentation } from '../styles';

Expand Down
1 change: 1 addition & 0 deletions components/Pages/styles/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client"
import styled from 'styled-components';

export const Container = styled.section`
Expand Down
32 changes: 32 additions & 0 deletions lib/registry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client'

import React, { useState } from 'react'
import { useServerInsertedHTML } from 'next/navigation'
import { ServerStyleSheet, StyleSheetManager, ThemeProvider, createGlobalStyle } from 'styled-components'
import { theme } from '@/styles/theme'



export default function StyledComponentsRegistry({
children,
}: {
children: React.ReactNode
}) {
// Only create stylesheet once with lazy initial state
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())

useServerInsertedHTML(() => {
const styles = styledComponentsStyleSheet.getStyleElement()
styledComponentsStyleSheet.instance.clearTag()
return <>{styles}</>
})

if (typeof window !== 'undefined') return <>{children}</>
console.log(theme)
return (
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
{children}
</StyleSheetManager>
)
}
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
module.exports = {
reactStrictMode: true,
output: 'export',
compiler: {
styledComponents: {
ssr:true
}
},

};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"next": "^14.2.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.11"
"styled-components": "^6.1.8"
},
"devDependencies": {
"@types/aos": "^3.0.7",
Expand Down
82 changes: 0 additions & 82 deletions pages/_app.tsx

This file was deleted.

Loading

0 comments on commit 309a17c

Please sign in to comment.