Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add blog * Add node types * Update tsconfig * Fix type issues * Update build settings * Rename blog route
- Loading branch information
Showing
43 changed files
with
630 additions
and
120 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
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,46 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
import { navHeight } from "./Nav"; | ||
|
||
const BlogPost = styled.div` | ||
margin: 0 auto; | ||
max-width: 768px; | ||
padding: 0 16px; | ||
font-family: Georgia, serif; | ||
font-size: 18px; | ||
height: calc(100vh - ${navHeight}px); | ||
overflow: auto; | ||
-webkit-overflow-scrolling: touch; | ||
backdrop-filter: blur(20px); | ||
border-top: 1px solid #fff2; | ||
border-left: 1px solid #fff2; | ||
border-right: 1px solid #fff2; | ||
border-top-left-radius: 4px; | ||
border-top-right-radius: 4px; | ||
|
||
h2 { | ||
margin-top: 40px; | ||
::after { | ||
content: ""; | ||
display: block; | ||
height: 1px; | ||
background: #ccc; | ||
margin-top: 4px; | ||
} | ||
} | ||
|
||
@media (min-width: 768px) { | ||
padding: 16px; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
background-color: #0002; | ||
box-shadow: 0 12px 32px #0006; | ||
|
||
h2::after { | ||
background: #fff2; | ||
} | ||
} | ||
`; | ||
|
||
export default BlogPost; |
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,35 @@ | ||
import React, { FC, Fragment } from "react"; | ||
import styled from "@emotion/styled"; | ||
|
||
const Container = styled.div` | ||
display: none; | ||
@media (min-width: 768px) { | ||
display: flex; | ||
font-size: 14px; | ||
letter-spacing: 1px; | ||
} | ||
`; | ||
|
||
const Separator = styled.span` | ||
margin: 0 8px; | ||
`; | ||
|
||
const Breadcrumb: FC<{ path: Array<{ label: string; link?: string }> }> = ({ path }) => { | ||
return ( | ||
<Container> | ||
{path.map((part, index) => | ||
part.link ? ( | ||
<Fragment key={part.link}> | ||
<a href={part.link}>{part.label}</a> | ||
{index < path.length - 1 && <Separator>/</Separator>} | ||
</Fragment> | ||
) : ( | ||
part.label | ||
), | ||
)} | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Breadcrumb; |
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,42 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
const Card = styled.div<{ center?: boolean }>` | ||
max-width: 768px; | ||
border-radius: 4px; | ||
box-shadow: 0 6px 8px #0001; | ||
padding: 24px; | ||
backdrop-filter: blur(20px); | ||
transition: box-shadow 0.3s ease, background-color 0.3s ease, transform 0.3s ease; | ||
cursor: pointer; | ||
z-index: 2; | ||
background-color: #fff; | ||
border: 1px solid #0002; | ||
${({ center }) => { | ||
if (center) { | ||
return `display: grid; align-items: center; justify-content: center;text-align: center;`; | ||
} | ||
return ""; | ||
}} | ||
:hover { | ||
transform: translateY(-4px); | ||
background-color: #fff1; | ||
box-shadow: 0 12px 32px #0003; | ||
} | ||
h2 { | ||
font-size: 24px; | ||
margin: 0; | ||
} | ||
@media (prefers-color-scheme: dark) { | ||
background-color: #0002; | ||
border: 1px solid #fff2; | ||
box-shadow: 0 6px 8px #0003; | ||
:hover { | ||
box-shadow: 0 12px 32px #0006; | ||
} | ||
} | ||
`; | ||
|
||
export default Card; |
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
const SectionHeading = styled.span` | ||
text-transform: uppercase; | ||
margin-top: 40px; | ||
margin-bottom: 8px; | ||
font-family: "DM Sans"; | ||
font-weight: bold; | ||
`; | ||
|
||
export default SectionHeading; |
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
const Title = styled.h1<{ length: number }>` | ||
const Title = styled.h1<{ length: number; color?: string }>` | ||
font-size: ${({ length }) => (length > 9 ? 12 : 17)}vw; | ||
font-weight: 400; | ||
position: absolute; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
margin: 0; | ||
padding: 0; | ||
z-index: -1; | ||
z-index: 1; | ||
line-height: 1; | ||
width: 100%; | ||
text-align: center; | ||
color: ${({ color }) => color || "inherit"}; | ||
`; | ||
|
||
export default Title; |
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,55 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
type Posts = { | ||
title: string; | ||
excerpt: string; | ||
}[]; | ||
|
||
export const useBlog = () => { | ||
const [posts, setPosts] = useState<Posts | null>(null); | ||
|
||
useEffect(() => { | ||
fetch("https://api.github.com/graphql", { | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, | ||
}, | ||
method: "POST", | ||
body: JSON.stringify({ | ||
query: `{ | ||
repository(name: "tejaskumar.com", owner: "TejasQ") { | ||
object(expression: "master:blog") { | ||
... on Tree { | ||
entries { | ||
name | ||
object { | ||
... on Blob { | ||
text | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
}), | ||
}) | ||
.then(r => r.json()) | ||
.then(r => | ||
setPosts( | ||
r.data.repository.object.entries.reverse().map((e: {name:string,object:{text:string}}) => ({ | ||
title: e.name.replace(".md", ""), | ||
excerpt: | ||
e.object.text | ||
.split("\n") | ||
.slice(1) | ||
.join("\n") | ||
.slice(0, 260) + "...", | ||
})), | ||
), | ||
); | ||
}, []); | ||
|
||
return posts; | ||
}; |
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,2 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> |
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 |
---|---|---|
@@ -1,19 +1,5 @@ | ||
// next.config.js | ||
const withTypescript = require("@zeit/next-typescript"); | ||
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); | ||
|
||
module.exports = withTypescript({ | ||
target: "serverless", | ||
|
||
webpack(config, options) { | ||
// Do not run type checking twice: | ||
if (options.isServer) config.plugins.push(new ForkTsCheckerWebpackPlugin()); | ||
|
||
return { | ||
...config, | ||
node: { | ||
fs: "empty", | ||
}, | ||
}; | ||
module.exports = { | ||
env: { | ||
GITHUB_TOKEN: process.env.GITHUB_TOKEN, | ||
}, | ||
}); | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
{ | ||
"version": 2, | ||
"builds": [{ "src": "package.json", "use": "@now/next@canary" }], | ||
"routes": [{ "src": "/static/tejass/.*", "headers": { "cache-control": "s-maxage=31557600" } }], | ||
"builds": [{ "src": "package.json", "use": "@now/next" }], | ||
"routes": [{ "src": "/public/tejass/.*", "headers": { "cache-control": "s-maxage=31557600" } }], | ||
"public": true, | ||
"regions": ["all"], | ||
"alias": ["tejaskumar.com", "www.tejaskumar.com", "xn--pn8hl7g.ws"] | ||
"alias": ["tejaskumar.com", "www.tejaskumar.com", "xn--pn8hl7g.ws"], | ||
"build": { | ||
"env": { | ||
"GITHUB_TOKEN": "@github-token" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
08904f2
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 following URLs: