Skip to content

Commit

Permalink
feat: add prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
praneeth-rdy committed Nov 24, 2024
1 parent 2e2b095 commit 0d216d1
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 88 deletions.
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"semi": true
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx}\"",
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx}\""
},
"dependencies": {
"@mdx-js/react": "^3.1.0",
Expand All @@ -44,6 +46,7 @@
"@types/node": "^20.11.19",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"prettier": "3.3.3",
"typescript": "^5.3.3"
}
}
34 changes: 17 additions & 17 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as React from "react"
import { Link, HeadFC, PageProps } from "gatsby"
import * as React from 'react';
import { Link, HeadFC, PageProps } from 'gatsby';

const pageStyles = {
color: "#232129",
padding: "96px",
fontFamily: "-apple-system, Roboto, sans-serif, serif",
}
color: '#232129',
padding: '96px',
fontFamily: '-apple-system, Roboto, sans-serif, serif',
};
const headingStyles = {
marginTop: 0,
marginBottom: 64,
maxWidth: 320,
}
};

const paragraphStyles = {
marginBottom: 48,
}
};
const codeStyles = {
color: "#8A6534",
color: '#8A6534',
padding: 4,
backgroundColor: "#FFF4DB",
fontSize: "1.25rem",
backgroundColor: '#FFF4DB',
fontSize: '1.25rem',
borderRadius: 4,
}
};

const NotFoundPage: React.FC<PageProps> = () => {
return (
Expand All @@ -30,7 +30,7 @@ const NotFoundPage: React.FC<PageProps> = () => {
<p style={paragraphStyles}>
Sorry 😔, we couldn’t find what you were looking for.
<br />
{process.env.NODE_ENV === "development" ? (
{process.env.NODE_ENV === 'development' ? (
<>
<br />
Try creating a page in <code style={codeStyles}>src/pages/</code>.
Expand All @@ -41,9 +41,9 @@ const NotFoundPage: React.FC<PageProps> = () => {
<Link to="/">Go home</Link>.
</p>
</main>
)
}
);
};

export default NotFoundPage
export default NotFoundPage;

export const Head: HeadFC = () => <title>Not found</title>
export const Head: HeadFC = () => <title>Not found</title>;
139 changes: 69 additions & 70 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,140 +1,140 @@
import * as React from "react"
import type { HeadFC, PageProps } from "gatsby"
import * as React from 'react';
import type { HeadFC, PageProps } from 'gatsby';

const pageStyles = {
color: "#232129",
color: '#232129',
padding: 96,
fontFamily: "-apple-system, Roboto, sans-serif, serif",
}
fontFamily: '-apple-system, Roboto, sans-serif, serif',
};
const headingStyles = {
marginTop: 0,
marginBottom: 64,
maxWidth: 320,
}
};
const headingAccentStyles = {
color: "#663399",
}
color: '#663399',
};
const paragraphStyles = {
marginBottom: 48,
}
};
const codeStyles = {
color: "#8A6534",
color: '#8A6534',
padding: 4,
backgroundColor: "#FFF4DB",
fontSize: "1.25rem",
backgroundColor: '#FFF4DB',
fontSize: '1.25rem',
borderRadius: 4,
}
};
const listStyles = {
marginBottom: 96,
paddingLeft: 0,
}
};
const doclistStyles = {
paddingLeft: 0,
}
};
const listItemStyles = {
fontWeight: 300,
fontSize: 24,
maxWidth: 560,
marginBottom: 30,
}
};

const linkStyle = {
color: "#8954A8",
fontWeight: "bold",
color: '#8954A8',
fontWeight: 'bold',
fontSize: 16,
verticalAlign: "5%",
}
verticalAlign: '5%',
};

const docLinkStyle = {
...linkStyle,
listStyleType: "none",
listStyleType: 'none',
display: `inline-block`,
marginBottom: 24,
marginRight: 12,
}
};

const descriptionStyle = {
color: "#232129",
color: '#232129',
fontSize: 14,
marginTop: 10,
marginBottom: 0,
lineHeight: 1.25,
}
};

const docLinks = [
{
text: "TypeScript Documentation",
url: "https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/",
color: "#8954A8",
text: 'TypeScript Documentation',
url: 'https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/',
color: '#8954A8',
},
{
text: "GraphQL Typegen Documentation",
url: "https://www.gatsbyjs.com/docs/how-to/local-development/graphql-typegen/",
color: "#8954A8",
}
]
text: 'GraphQL Typegen Documentation',
url: 'https://www.gatsbyjs.com/docs/how-to/local-development/graphql-typegen/',
color: '#8954A8',
},
];

const badgeStyle = {
color: "#fff",
backgroundColor: "#088413",
border: "1px solid #088413",
color: '#fff',
backgroundColor: '#088413',
border: '1px solid #088413',
fontSize: 11,
fontWeight: "bold",
fontWeight: 'bold',
letterSpacing: 1,
borderRadius: 4,
padding: "4px 6px",
display: "inline-block",
position: "relative" as "relative",
padding: '4px 6px',
display: 'inline-block',
position: 'relative' as 'relative',
top: -2,
marginLeft: 10,
lineHeight: 1,
}
};

const links = [
{
text: "Tutorial",
url: "https://www.gatsbyjs.com/docs/tutorial/getting-started/",
text: 'Tutorial',
url: 'https://www.gatsbyjs.com/docs/tutorial/getting-started/',
description:
"A great place to get started if you're new to web development. Designed to guide you through setting up your first Gatsby site.",
color: "#E95800",
color: '#E95800',
},
{
text: "How to Guides",
url: "https://www.gatsbyjs.com/docs/how-to/",
text: 'How to Guides',
url: 'https://www.gatsbyjs.com/docs/how-to/',
description:
"Practical step-by-step guides to help you achieve a specific goal. Most useful when you're trying to get something done.",
color: "#1099A8",
color: '#1099A8',
},
{
text: "Reference Guides",
url: "https://www.gatsbyjs.com/docs/reference/",
text: 'Reference Guides',
url: 'https://www.gatsbyjs.com/docs/reference/',
description:
"Nitty-gritty technical descriptions of how Gatsby works. Most useful when you need detailed information about Gatsby's APIs.",
color: "#BC027F",
color: '#BC027F',
},
{
text: "Conceptual Guides",
url: "https://www.gatsbyjs.com/docs/conceptual/",
text: 'Conceptual Guides',
url: 'https://www.gatsbyjs.com/docs/conceptual/',
description:
"Big-picture explanations of higher-level Gatsby concepts. Most useful for building understanding of a particular topic.",
color: "#0D96F2",
'Big-picture explanations of higher-level Gatsby concepts. Most useful for building understanding of a particular topic.',
color: '#0D96F2',
},
{
text: "Plugin Library",
url: "https://www.gatsbyjs.com/plugins",
text: 'Plugin Library',
url: 'https://www.gatsbyjs.com/plugins',
description:
"Add functionality and customize your Gatsby site or app with thousands of plugins built by our amazing developer community.",
color: "#8EB814",
'Add functionality and customize your Gatsby site or app with thousands of plugins built by our amazing developer community.',
color: '#8EB814',
},
{
text: "Build and Host",
url: "https://www.gatsbyjs.com/cloud",
text: 'Build and Host',
url: 'https://www.gatsbyjs.com/cloud',
badge: true,
description:
"Now you’re ready to show the world! Give your Gatsby site superpowers: Build and host on Gatsby Cloud. Get started for free!",
color: "#663399",
'Now you’re ready to show the world! Give your Gatsby site superpowers: Build and host on Gatsby Cloud. Get started for free!',
color: '#663399',
},
]
];

const IndexPage: React.FC<PageProps> = () => {
return (
Expand All @@ -145,11 +145,10 @@ const IndexPage: React.FC<PageProps> = () => {
<span style={headingAccentStyles}>— you just made a Gatsby site! 🎉🎉🎉</span>
</h1>
<p style={paragraphStyles}>
Edit <code style={codeStyles}>src/pages/index.tsx</code> to see this page
update in real-time. 😎
Edit <code style={codeStyles}>src/pages/index.tsx</code> to see this page update in real-time. 😎
</p>
<ul style={doclistStyles}>
{docLinks.map(doc => (
{docLinks.map((doc) => (
<li key={doc.url} style={docLinkStyle}>
<a
style={linkStyle}
Expand All @@ -161,7 +160,7 @@ const IndexPage: React.FC<PageProps> = () => {
))}
</ul>
<ul style={listStyles}>
{links.map(link => (
{links.map((link) => (
<li key={link.url} style={{ ...listItemStyles, color: link.color }}>
<span>
<a
Expand All @@ -185,9 +184,9 @@ const IndexPage: React.FC<PageProps> = () => {
src="data:image/svg+xml,%3Csvg width='24' height='24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2a10 10 0 110 20 10 10 0 010-20zm0 2c-3.73 0-6.86 2.55-7.75 6L14 19.75c3.45-.89 6-4.02 6-7.75h-5.25v1.5h3.45a6.37 6.37 0 01-3.89 4.44L6.06 9.69C7 7.31 9.3 5.63 12 5.63c2.13 0 4 1.04 5.18 2.65l1.23-1.06A7.959 7.959 0 0012 4zm-8 8a8 8 0 008 8c.04 0 .09 0-8-8z' fill='%23639'/%3E%3C/svg%3E"
/>
</main>
)
}
);
};

export default IndexPage
export default IndexPage;

export const Head: HeadFC = () => <title>Home Page</title>
export const Head: HeadFC = () => <title>Home Page</title>;
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9010,6 +9010,11 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==

[email protected]:
version "3.3.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==

pretty-bytes@^5.6.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
Expand Down

0 comments on commit 0d216d1

Please sign in to comment.