-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connecting to prismic and creating about page
- Loading branch information
Showing
15 changed files
with
5,576 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"slices": { | ||
"components": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as prismic from "@prismicio/client"; | ||
import { enableAutoPreviews } from "@prismicio/next"; | ||
import sm from "./sm.json"; | ||
|
||
export const endpoint = sm.apiEndpoint; | ||
export const repositoryName = prismic.getRepositoryName(endpoint); | ||
|
||
export function linkResolver(doc) { | ||
switch (doc.type) { | ||
case "homepage": | ||
return "/"; | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
export function createClient(config = {}) { | ||
const client = prismic.createClient(endpoint, { | ||
...config, | ||
}); | ||
|
||
enableAutoPreviews({ | ||
client, | ||
previewData: config.previewData, | ||
req: config.req, | ||
}); | ||
|
||
return client; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"_latest": "0.3.0", | ||
"apiEndpoint": "https://arthursena.prismic.io/api/v2", | ||
"libraries": ["@/slices"], | ||
"framework": "previousNext" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from "react"; | ||
import { createClient } from "../../../prismicio"; | ||
|
||
export default function Post() { | ||
return <></>; | ||
} | ||
|
||
export async function getServerSideProps({ previewData, params }) { | ||
const client = createClient({ previewData }); | ||
|
||
const { slug } = params; | ||
const project = await client.getByUID("project", slug, { ref: null }); | ||
|
||
return { | ||
props: { project }, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import React from "react"; | ||
import Head from "next/head"; | ||
import Typed from "typed.js"; | ||
import { PrismicRichText } from "@prismicio/react"; | ||
import Tooltip from "@mui/material/Tooltip"; | ||
|
||
import { createClient } from "../../prismicio"; | ||
|
||
import { Avatar, Container, ToolsContainer, Work } from "../styles/Sobre"; | ||
|
||
/** | ||
* Sobre Page | ||
* @return {JSX.Element} | ||
*/ | ||
|
||
type WorkExperience = { | ||
job: string; | ||
date: string; | ||
link: string; | ||
company: string; | ||
}; | ||
|
||
type Tool = { | ||
name: string; | ||
icon: string; | ||
}; | ||
|
||
type Content = { | ||
avatar: string; | ||
title: string; | ||
description: []; | ||
typed: string[]; | ||
tools: Tool[]; | ||
work: WorkExperience[]; | ||
}; | ||
|
||
interface SobreProps { | ||
content: Content; | ||
} | ||
|
||
export default function Sobre({ content }: SobreProps): JSX.Element { | ||
const el = React.useRef(null); | ||
|
||
React.useEffect(() => { | ||
const typed = new Typed(el?.current, { | ||
strings: content.typed || [], | ||
typeSpeed: 50, | ||
backSpeed: 50, | ||
backDelay: 70, | ||
loop: true, | ||
showCursor: false, | ||
}); | ||
|
||
// eslint-disable-next-line consistent-return | ||
return () => { | ||
typed.destroy(); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Container> | ||
<Head> | ||
<title>Sobre | Arthur Sena</title> | ||
</Head> | ||
<Avatar> | ||
<img | ||
src={content?.avatar} | ||
alt="Foto de Arthur Sena" | ||
className="avatar" | ||
/> | ||
<div> | ||
<h1>Arthur Sena</h1> | ||
<h2>{content?.title}</h2> | ||
<span ref={el} className="typed" /> | ||
<div className="social-media"> | ||
<a | ||
href="https://github.com/senaarth" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
<img src="/images/github.png" alt="Logo Github" /> | ||
</a> | ||
<a | ||
href="https://linkedin.com/in/senaarth" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
<img src="/images/linkedin.png" alt="Logo Linkedin" /> | ||
</a> | ||
</div> | ||
</div> | ||
</Avatar> | ||
<PrismicRichText | ||
field={content?.description} | ||
components={{ | ||
paragraph: ({ children }) => <p className="desc">{children}</p>, | ||
}} | ||
/> | ||
<Work> | ||
<h3>Experiência Profissional</h3> | ||
{content?.work?.map((item) => { | ||
return ( | ||
<div key={item.date}> | ||
<h4>{item?.job}</h4> | ||
<a href={item?.link} target="_blank" rel="noreferrer"> | ||
{item?.company} | ||
</a> | ||
<p>{item?.date}</p> | ||
</div> | ||
); | ||
})} | ||
</Work> | ||
<h3>Principais Ferramentas</h3> | ||
<ToolsContainer> | ||
{content.tools?.map((item) => { | ||
return ( | ||
<Tooltip title={item?.name} key={item?.name}> | ||
<div> | ||
<img src={item?.icon} alt={item?.name} /> | ||
</div> | ||
</Tooltip> | ||
); | ||
})} | ||
</ToolsContainer> | ||
</Container> | ||
); | ||
} | ||
|
||
export async function getServerSideProps({ previewData }) { | ||
const client = createClient({ previewData }); | ||
|
||
const { data } = await client.getSingle("about"); | ||
|
||
const content = { | ||
avatar: data?.avatar?.url, | ||
description: data?.description, | ||
title: data?.title, | ||
typed: data?.tools_typed?.map((item) => item?.tool), | ||
tools: data?.tools?.map((item) => { | ||
return { | ||
...item, | ||
icon: item?.icon.url, | ||
}; | ||
}), | ||
work: data?.work?.map((item) => { | ||
return { | ||
...item, | ||
link: item?.link.url, | ||
}; | ||
}), | ||
}; | ||
|
||
return { | ||
props: { content }, | ||
}; | ||
} |
Oops, something went wrong.
653b99c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
arthursena – ./
arthursena-arthursena.vercel.app
senaarth.vercel.app
arthursena-git-master-arthursena.vercel.app
arthursena.com.br
senaarth.com.br
www.senaarth.com.br
www.arthursena.com.br