This commit is contained in:
desmukh
2023-01-05 12:13:30 +05:00
commit 935f94975b
28 changed files with 12394 additions and 0 deletions

58
src/components/bio.js Normal file
View File

@ -0,0 +1,58 @@
/**
* Bio component that queries for data
* with Gatsby's useStaticQuery component
*
* See: https://www.gatsbyjs.com/docs/how-to/querying-data/use-static-query/
*/
import * as React from "react"
import { useStaticQuery, graphql } from "gatsby"
import { StaticImage } from "gatsby-plugin-image"
const Bio = () => {
const data = useStaticQuery(graphql`
query BioQuery {
site {
siteMetadata {
author {
name
summary
}
social {
twitter
}
}
}
}
`)
// Set these values by editing "siteMetadata" in gatsby-config.js
const author = data.site.siteMetadata?.author
const social = data.site.siteMetadata?.social
return (
<div className="bio">
<StaticImage
className="bio-avatar"
layout="fixed"
formats={["auto", "webp", "avif"]}
src="../images/profile-pic.png"
width={50}
height={50}
quality={95}
alt="Profile picture"
/>
{author?.name && (
<p>
Written by <strong>{author.name}</strong> {author?.summary || null}
{` `}
<a href={`https://twitter.com/${social?.twitter || ``}`}>
You should follow them on Twitter
</a>
</p>
)}
</div>
)
}
export default Bio

36
src/components/layout.js Normal file
View File

@ -0,0 +1,36 @@
import * as React from "react"
import { Link } from "gatsby"
const Layout = ({ location, title, children }) => {
const rootPath = `${__PATH_PREFIX__}/`
const isRootPath = location.pathname === rootPath
let header
if (isRootPath) {
header = (
<h1 className="main-heading">
<Link to="/">{title}</Link>
</h1>
)
} else {
header = (
<Link className="header-link-home" to="/">
{title}
</Link>
)
}
return (
<div className="global-wrapper" data-is-root-path={isRootPath}>
<header className="global-header">{header}</header>
<main>{children}</main>
<footer>
© {new Date().getFullYear()}, Built with
{` `}
<a href="https://www.gatsbyjs.com">Gatsby</a>
</footer>
</div>
)
}
export default Layout

50
src/components/seo.js Normal file
View File

@ -0,0 +1,50 @@
/**
* SEO component that queries for data with
* Gatsby's useStaticQuery React hook
*
* See: https://www.gatsbyjs.com/docs/how-to/querying-data/use-static-query/
*/
import * as React from "react"
import { useStaticQuery, graphql } from "gatsby"
const Seo = ({ description, title, children }) => {
const { site } = useStaticQuery(
graphql`
query {
site {
siteMetadata {
title
description
social {
twitter
}
}
}
}
`
)
const metaDescription = description || site.siteMetadata.description
const defaultTitle = site.siteMetadata?.title
return (
<>
<title>{defaultTitle ? `${title} | ${defaultTitle}` : title}</title>
<meta name="description" content={metaDescription} />
<meta property="og:title" content={title} />
<meta property="og:description" content={metaDescription} />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta
name="twitter:creator"
content={site.siteMetadata?.social?.twitter || ``}
/>
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={metaDescription} />
{children}
</>
)
}
export default Seo

BIN
src/images/gatsby-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
src/images/profile-pic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

343
src/normalize.css vendored Normal file
View File

@ -0,0 +1,343 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input {
/* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select {
/* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

30
src/pages/404.js Normal file
View File

@ -0,0 +1,30 @@
import * as React from "react"
import { graphql } from "gatsby"
import Layout from "../components/layout"
import Seo from "../components/seo"
const NotFoundPage = ({ data, location }) => {
const siteTitle = data.site.siteMetadata.title
return (
<Layout location={location} title={siteTitle}>
<h1>404: Not Found</h1>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
</Layout>
)
}
export const Head = () => <Seo title="404: Not Found" />
export default NotFoundPage
export const pageQuery = graphql`
query {
site {
siteMetadata {
title
}
}
}
`

94
src/pages/index.js Normal file
View File

@ -0,0 +1,94 @@
import * as React from "react"
import { Link, graphql } from "gatsby"
import Bio from "../components/bio"
import Layout from "../components/layout"
import Seo from "../components/seo"
const BlogIndex = ({ data, location }) => {
const siteTitle = data.site.siteMetadata?.title || `Title`
const posts = data.allMarkdownRemark.nodes
if (posts.length === 0) {
return (
<Layout location={location} title={siteTitle}>
<Bio />
<p>
No blog posts found. Add markdown posts to "content/blog" (or the
directory you specified for the "gatsby-source-filesystem" plugin in
gatsby-config.js).
</p>
</Layout>
)
}
return (
<Layout location={location} title={siteTitle}>
<Bio />
<ol style={{ listStyle: `none` }}>
{posts.map(post => {
const title = post.frontmatter.title || post.fields.slug
return (
<li key={post.fields.slug}>
<article
className="post-list-item"
itemScope
itemType="http://schema.org/Article"
>
<header>
<h2>
<Link to={post.fields.slug} itemProp="url">
<span itemProp="headline">{title}</span>
</Link>
</h2>
<small>{post.frontmatter.date}</small>
</header>
<section>
<p
dangerouslySetInnerHTML={{
__html: post.frontmatter.description || post.excerpt,
}}
itemProp="description"
/>
</section>
</article>
</li>
)
})}
</ol>
</Layout>
)
}
export default BlogIndex
/**
* Head export to define metadata for the page
*
* See: https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-head/
*/
export const Head = () => <Seo title="All posts" />
export const pageQuery = graphql`
{
site {
siteMetadata {
title
}
}
allMarkdownRemark(sort: { frontmatter: { date: DESC } }) {
nodes {
excerpt
fields {
slug
}
frontmatter {
date(formatString: "MMMM DD, YYYY")
title
description
}
}
}
}
`

View File

@ -0,0 +1,55 @@
// If you don't want to use TypeScript you can delete this file!
import * as React from "react"
import { PageProps, Link, graphql, HeadFC } from "gatsby"
import Layout from "../components/layout"
import Seo from "../components/seo"
type DataProps = {
site: {
buildTime: string
}
}
const UsingTypescript: React.FC<PageProps<DataProps>> = ({
data,
path,
location,
}) => (
<Layout title="Using TypeScript" location={location}>
<h1>Gatsby supports TypeScript by default!</h1>
<p>
This means that you can create and write <em>.ts/.tsx</em> files for your
pages, components etc. Please note that the <em>gatsby-*.js</em> files
(like gatsby-node.js) currently don't support TypeScript yet.
</p>
<p>
For type checking you'll want to install <em>typescript</em> via npm and
run <em>tsc --init</em> to create a <em>tsconfig</em> file.
</p>
<p>
You're currently on the page "{path}" which was built on{" "}
{data.site.buildTime}.
</p>
<p>
To learn more, head over to our{" "}
<a href="https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/">
documentation about TypeScript
</a>
.
</p>
<Link to="/">Go back to the homepage</Link>
</Layout>
)
export const Head: HeadFC<DataProps> = () => <Seo title="Using TypeScript" />
export default UsingTypescript
export const query = graphql`
{
site {
buildTime(formatString: "YYYY-MM-DD hh:mm a z")
}
}
`

331
src/style.css Normal file
View File

@ -0,0 +1,331 @@
/* CSS Custom Properties Definitions */
:root {
--maxWidth-none: "none";
--maxWidth-xs: 20rem;
--maxWidth-sm: 24rem;
--maxWidth-md: 28rem;
--maxWidth-lg: 32rem;
--maxWidth-xl: 36rem;
--maxWidth-2xl: 42rem;
--maxWidth-3xl: 48rem;
--maxWidth-4xl: 56rem;
--maxWidth-full: "100%";
--maxWidth-wrapper: var(--maxWidth-2xl);
--spacing-px: "1px";
--spacing-0: 0;
--spacing-1: 0.25rem;
--spacing-2: 0.5rem;
--spacing-3: 0.75rem;
--spacing-4: 1rem;
--spacing-5: 1.25rem;
--spacing-6: 1.5rem;
--spacing-8: 2rem;
--spacing-10: 2.5rem;
--spacing-12: 3rem;
--spacing-16: 4rem;
--spacing-20: 5rem;
--spacing-24: 6rem;
--spacing-32: 8rem;
--fontFamily-sans: "MontserratVariable", system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
--fontFamily-serif: "Merriweather", "Georgia", Cambria, "Times New Roman",
Times, serif;
--font-body: var(--fontFamily-serif);
--font-heading: var(--fontFamily-sans);
--fontWeight-normal: 400;
--fontWeight-bold: 700;
--fontWeight-black: 900;
--fontSize-root: 16px;
--lineHeight-none: 1;
--lineHeight-tight: 1.1;
--lineHeight-normal: 1.5;
--lineHeight-relaxed: 1.625;
/* 1.200 Minor Third Type Scale */
--fontSize-0: 0.833rem;
--fontSize-1: 1rem;
--fontSize-2: 1.2rem;
--fontSize-3: 1.44rem;
--fontSize-4: 1.728rem;
--fontSize-5: 2.074rem;
--fontSize-6: 2.488rem;
--fontSize-7: 2.986rem;
--color-primary: #005b99;
--color-text: #2e353f;
--color-text-light: #4f5969;
--color-heading: #1a202c;
--color-heading-black: black;
--color-accent: #d1dce5;
}
/* HTML elements */
*,
:after,
:before {
box-sizing: border-box;
}
html {
line-height: var(--lineHeight-normal);
font-size: var(--fontSize-root);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: var(--font-body);
font-size: var(--fontSize-1);
color: var(--color-text);
}
footer {
padding: var(--spacing-6) var(--spacing-0);
}
hr {
background: var(--color-accent);
height: 1px;
border: 0;
}
/* Heading */
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: var(--font-heading);
margin-top: var(--spacing-12);
margin-bottom: var(--spacing-6);
line-height: var(--lineHeight-tight);
letter-spacing: -0.025em;
}
h2,
h3,
h4,
h5,
h6 {
font-weight: var(--fontWeight-bold);
color: var(--color-heading);
}
h1 {
font-weight: var(--fontWeight-black);
font-size: var(--fontSize-6);
color: var(--color-heading-black);
}
h2 {
font-size: var(--fontSize-5);
}
h3 {
font-size: var(--fontSize-4);
}
h4 {
font-size: var(--fontSize-3);
}
h5 {
font-size: var(--fontSize-2);
}
h6 {
font-size: var(--fontSize-1);
}
h1 > a {
color: inherit;
text-decoration: none;
}
h2 > a,
h3 > a,
h4 > a,
h5 > a,
h6 > a {
text-decoration: none;
color: inherit;
}
/* Prose */
p {
line-height: var(--lineHeight-relaxed);
--baseline-multiplier: 0.179;
--x-height-multiplier: 0.35;
margin: var(--spacing-0) var(--spacing-0) var(--spacing-8) var(--spacing-0);
padding: var(--spacing-0);
}
ul,
ol {
margin-left: var(--spacing-0);
margin-right: var(--spacing-0);
padding: var(--spacing-0);
margin-bottom: var(--spacing-8);
list-style-position: outside;
list-style-image: none;
}
ul li,
ol li {
padding-left: var(--spacing-0);
margin-bottom: calc(var(--spacing-8) / 2);
}
li > p {
margin-bottom: calc(var(--spacing-8) / 2);
}
li *:last-child {
margin-bottom: var(--spacing-0);
}
li > ul {
margin-left: var(--spacing-8);
margin-top: calc(var(--spacing-8) / 2);
}
blockquote {
color: var(--color-text-light);
margin-left: calc(-1 * var(--spacing-6));
margin-right: var(--spacing-8);
padding: var(--spacing-0) var(--spacing-0) var(--spacing-0) var(--spacing-6);
border-left: var(--spacing-1) solid var(--color-primary);
font-size: var(--fontSize-2);
font-style: italic;
margin-bottom: var(--spacing-8);
}
blockquote > :last-child {
margin-bottom: var(--spacing-0);
}
blockquote > ul,
blockquote > ol {
list-style-position: inside;
}
table {
width: 100%;
margin-bottom: var(--spacing-8);
border-collapse: collapse;
border-spacing: 0.25rem;
}
table thead tr th {
border-bottom: 1px solid var(--color-accent);
}
/* Link */
a {
color: var(--color-primary);
}
a:hover,
a:focus {
text-decoration: none;
}
/* Custom classes */
.global-wrapper {
margin: var(--spacing-0) auto;
max-width: var(--maxWidth-wrapper);
padding: var(--spacing-10) var(--spacing-5);
}
.global-wrapper[data-is-root-path="true"] .bio {
margin-bottom: var(--spacing-20);
}
.global-header {
margin-bottom: var(--spacing-12);
}
.main-heading {
font-size: var(--fontSize-7);
margin: 0;
}
.post-list-item {
margin-bottom: var(--spacing-8);
margin-top: var(--spacing-8);
}
.post-list-item p {
margin-bottom: var(--spacing-0);
}
.post-list-item h2 {
font-size: var(--fontSize-4);
color: var(--color-primary);
margin-bottom: var(--spacing-2);
margin-top: var(--spacing-0);
}
.post-list-item header {
margin-bottom: var(--spacing-4);
}
.header-link-home {
font-weight: var(--fontWeight-bold);
font-family: var(--font-heading);
text-decoration: none;
font-size: var(--fontSize-2);
}
.bio {
display: flex;
margin-bottom: var(--spacing-16);
}
.bio p {
margin-bottom: var(--spacing-0);
}
.bio-avatar {
margin-right: var(--spacing-4);
margin-bottom: var(--spacing-0);
min-width: 50px;
border-radius: 100%;
}
.blog-post header h1 {
margin: var(--spacing-0) var(--spacing-0) var(--spacing-4) var(--spacing-0);
}
.blog-post header p {
font-size: var(--fontSize-2);
font-family: var(--font-heading);
}
.blog-post-nav ul {
margin: var(--spacing-0);
}
.gatsby-highlight {
margin-bottom: var(--spacing-8);
}
/* Media queries */
@media (max-width: 42rem) {
blockquote {
padding: var(--spacing-0) var(--spacing-0) var(--spacing-0) var(--spacing-4);
margin-left: var(--spacing-0);
}
ul,
ol {
list-style-position: inside;
}
}

113
src/templates/blog-post.js Normal file
View File

@ -0,0 +1,113 @@
import * as React from "react"
import { Link, graphql } from "gatsby"
import Bio from "../components/bio"
import Layout from "../components/layout"
import Seo from "../components/seo"
const BlogPostTemplate = ({
data: { previous, next, site, markdownRemark: post },
location,
}) => {
const siteTitle = site.siteMetadata?.title || `Title`
return (
<Layout location={location} title={siteTitle}>
<article
className="blog-post"
itemScope
itemType="http://schema.org/Article"
>
<header>
<h1 itemProp="headline">{post.frontmatter.title}</h1>
<p>{post.frontmatter.date}</p>
</header>
<section
dangerouslySetInnerHTML={{ __html: post.html }}
itemProp="articleBody"
/>
<hr />
<footer>
<Bio />
</footer>
</article>
<nav className="blog-post-nav">
<ul
style={{
display: `flex`,
flexWrap: `wrap`,
justifyContent: `space-between`,
listStyle: `none`,
padding: 0,
}}
>
<li>
{previous && (
<Link to={previous.fields.slug} rel="prev">
{previous.frontmatter.title}
</Link>
)}
</li>
<li>
{next && (
<Link to={next.fields.slug} rel="next">
{next.frontmatter.title}
</Link>
)}
</li>
</ul>
</nav>
</Layout>
)
}
export const Head = ({ data: { markdownRemark: post } }) => {
return (
<Seo
title={post.frontmatter.title}
description={post.frontmatter.description || post.excerpt}
/>
)
}
export default BlogPostTemplate
export const pageQuery = graphql`
query BlogPostBySlug(
$id: String!
$previousPostId: String
$nextPostId: String
) {
site {
siteMetadata {
title
}
}
markdownRemark(id: { eq: $id }) {
id
excerpt(pruneLength: 160)
html
frontmatter {
title
date(formatString: "MMMM DD, YYYY")
description
}
}
previous: markdownRemark(id: { eq: $previousPostId }) {
fields {
slug
}
frontmatter {
title
}
}
next: markdownRemark(id: { eq: $nextPostId }) {
fields {
slug
}
frontmatter {
title
}
}
}
`