Formatting

This commit is contained in:
SkyfallWasTaken 2024-07-06 12:56:31 +01:00
parent 562a36c454
commit 3d317a8a45
26 changed files with 367 additions and 301 deletions

16
.prettierrc.mjs Normal file
View file

@ -0,0 +1,16 @@
// .prettierrc.mjs
/** @type {import("prettier").Config} */
export default {
trailingComma: "all",
singleQuote: false,
plugins: ["prettier-plugin-astro"],
overrides: [
{
files: "*.astro",
options: {
parser: "astro",
},
},
],
};

View file

@ -1,11 +1,11 @@
import { defineConfig } from 'astro/config'; import { defineConfig } from "astro/config";
import mdx from '@astrojs/mdx'; import mdx from "@astrojs/mdx";
import sitemap from '@astrojs/sitemap'; import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind"; import tailwind from "@astrojs/tailwind";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: 'https://example.com', site: "https://example.com",
integrations: [mdx(), sitemap(), tailwind()] integrations: [mdx(), sitemap(), tailwind()],
}); });

BIN
bun.lockb

Binary file not shown.

View file

@ -7,18 +7,23 @@
"start": "astro dev", "start": "astro dev",
"build": "astro check && astro build", "build": "astro check && astro build",
"preview": "astro preview", "preview": "astro preview",
"format": "prettier --write .",
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "tailwind-merge": "^2.3.0" }, "dependencies": {
"tailwind-merge": "^2.3.0"
},
"devDependencies": { "devDependencies": {
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3",
"@catppuccin/tailwindcss": "^0.1.6",
"@astrojs/check": "^0.7.0", "@astrojs/check": "^0.7.0",
"@astrojs/mdx": "^3.1.2", "@astrojs/mdx": "^3.1.2",
"@astrojs/rss": "^4.0.7", "@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6", "@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.0", "@astrojs/tailwind": "^5.1.0",
"astro": "^4.11.5" "@catppuccin/tailwindcss": "^0.1.6",
"astro": "^4.11.5",
"prettier": "^3.3.2",
"prettier-plugin-astro": "^0.14.0",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3"
} }
} }

View file

@ -1,17 +1,17 @@
--- ---
// Import the global.css file here so that it is included on // Import the global.css file here so that it is included on
// all pages through the use of the <BaseHead /> component. // all pages through the use of the <BaseHead /> component.
import '../styles/global.css'; import "../styles/global.css";
interface Props { interface Props {
title: string; title: string;
description: string; description: string;
image?: string; image?: string;
} }
const canonicalURL = new URL(Astro.url.pathname, Astro.site); const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; const { title, description, image = "/blog-placeholder-1.jpg" } = Astro.props;
--- ---
<!-- Global Metadata --> <!-- Global Metadata -->
@ -21,8 +21,20 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props;
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
<!-- Font preloads --> <!-- Font preloads -->
<link rel="preload" href="/fonts/atkinson-regular.woff" as="font" type="font/woff" crossorigin /> <link
<link rel="preload" href="/fonts/atkinson-bold.woff" as="font" type="font/woff" crossorigin /> rel="preload"
href="/fonts/atkinson-regular.woff"
as="font"
type="font/woff"
crossorigin
/>
<link
rel="preload"
href="/fonts/atkinson-bold.woff"
as="font"
type="font/woff"
crossorigin
/>
<!-- Canonical URL --> <!-- Canonical URL -->
<link rel="canonical" href={canonicalURL} /> <link rel="canonical" href={canonicalURL} />

View file

@ -6,9 +6,9 @@ const today = new Date();
--- ---
<footer class="bg-crust text-text flex flex-col items-center py-4"> <footer class="bg-crust text-text flex flex-col items-center py-4">
&copy; {today.getFullYear()} Skyfall. All rights reserved. &copy; {today.getFullYear()} Skyfall. All rights reserved.
<div class="flex flex-row gap-3 m-2"> <div class="flex flex-row gap-3 m-2">
<Twitter /> <Twitter />
<GitHub /> <GitHub />
</div> </div>
</footer> </footer>

View file

@ -1,17 +1,17 @@
--- ---
interface Props { interface Props {
date: Date; date: Date;
} }
const { date } = Astro.props; const { date } = Astro.props;
--- ---
<time datetime={date.toISOString()}> <time datetime={date.toISOString()}>
{ {
date.toLocaleDateString('en-us', { date.toLocaleDateString("en-us", {
year: 'numeric', year: "numeric",
month: 'short', month: "short",
day: 'numeric', day: "numeric",
}) })
} }
</time> </time>

View file

@ -1,21 +1,23 @@
--- ---
import HeaderLink from './HeaderLink.astro'; import HeaderLink from "./HeaderLink.astro";
import { SITE_TITLE } from '../consts'; import { SITE_TITLE } from "../consts";
import Twitter from './socialIcons/Twitter.astro'; import Twitter from "./socialIcons/Twitter.astro";
import GitHub from './socialIcons/GitHub.astro'; import GitHub from "./socialIcons/GitHub.astro";
--- ---
<header class="w-full"> <header class="w-full">
<nav class="px-3 py-2 flex items-center gap-2 w-full border-b-[2px] border-surface0 shadow-sm bg-crust text-text"> <nav
<h2 class="font-semibold mx-3"><a href="/">{SITE_TITLE}</a></h2> class="px-3 py-2 flex items-center gap-2 w-full border-b-[2px] border-surface0 shadow-sm bg-crust text-text"
<div class="flex flew-row gap-3"> >
<HeaderLink href="/">Home</HeaderLink> <h2 class="font-semibold mx-3"><a href="/">{SITE_TITLE}</a></h2>
<HeaderLink href="/blog">Blog</HeaderLink> <div class="flex flew-row gap-3">
<HeaderLink href="/about">About</HeaderLink> <HeaderLink href="/">Home</HeaderLink>
</div> <HeaderLink href="/blog">Blog</HeaderLink>
<div class="flex flex-row gap-3 ml-auto m-2"> <HeaderLink href="/about">About</HeaderLink>
<Twitter /> </div>
<GitHub /> <div class="flex flex-row gap-3 ml-auto m-2">
</div> <Twitter />
</nav> <GitHub />
</div>
</nav>
</header> </header>

View file

@ -1,15 +1,15 @@
--- ---
import type { HTMLAttributes } from 'astro/types'; import type { HTMLAttributes } from "astro/types";
type Props = HTMLAttributes<'a'>; type Props = HTMLAttributes<"a">;
const { href, class: className, ...props } = Astro.props; const { href, class: className, ...props } = Astro.props;
const { pathname } = Astro.url; const { pathname } = Astro.url;
const subpath = pathname.match(/[^\/]+/g); const subpath = pathname.match(/[^\/]+/g);
const isActive = href === pathname || href === '/' + subpath?.[0]; const isActive = href === pathname || href === "/" + subpath?.[0];
--- ---
<a href={href} class:list={[className, { active: isActive }]} {...props}> <a href={href} class:list={[className, { active: isActive }]} {...props}>
<slot /> <slot />
</a> </a>

View file

@ -1,9 +1,9 @@
<a href="https://github.com/SkyfallWasTaken" target="_blank"> <a href="https://github.com/SkyfallWasTaken" target="_blank">
<span class="sr-only">Go to Skyfall's GitHub profile</span> <span class="sr-only">Go to Skyfall's GitHub profile</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32"
><path ><path
fill="currentColor" fill="currentColor"
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"
></path></svg ></path></svg
> >
</a> </a>

View file

@ -1,9 +1,9 @@
<a href="https://twitter.com/skyfall_ggs" target="_blank"> <a href="https://twitter.com/skyfall_ggs" target="_blank">
<span class="sr-only">Follow me on Twitter</span> <span class="sr-only">Follow me on Twitter</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32"
><path ><path
fill="currentColor" fill="currentColor"
d="M5.026 15c6.038 0 9.341-5.003 9.341-9.334 0-.14 0-.282-.006-.422A6.685 6.685 0 0 0 16 3.542a6.658 6.658 0 0 1-1.889.518 3.301 3.301 0 0 0 1.447-1.817 6.533 6.533 0 0 1-2.087.793A3.286 3.286 0 0 0 7.875 6.03a9.325 9.325 0 0 1-6.767-3.429 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 6.575v.045a3.288 3.288 0 0 0 2.632 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.614-.057 3.283 3.283 0 0 0 3.067 2.277A6.588 6.588 0 0 1 .78 13.58a6.32 6.32 0 0 1-.78-.045A9.344 9.344 0 0 0 5.026 15z" d="M5.026 15c6.038 0 9.341-5.003 9.341-9.334 0-.14 0-.282-.006-.422A6.685 6.685 0 0 0 16 3.542a6.658 6.658 0 0 1-1.889.518 3.301 3.301 0 0 0 1.447-1.817 6.533 6.533 0 0 1-2.087.793A3.286 3.286 0 0 0 7.875 6.03a9.325 9.325 0 0 1-6.767-3.429 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 6.575v.045a3.288 3.288 0 0 0 2.632 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.614-.057 3.283 3.283 0 0 0 3.067 2.277A6.588 6.588 0 0 1 .78 13.58a6.32 6.32 0 0 1-.78-.045A9.344 9.344 0 0 0 5.026 15z"
></path></svg ></path></svg
> >
</a> </a>

View file

@ -1,8 +1,14 @@
--- ---
import {twMerge} from "tailwind-merge"; import { twMerge } from "tailwind-merge";
const { class: className, ...rest } = Astro.props; const { class: className, ...rest } = Astro.props;
--- ---
<button class={twMerge("shadow-sm px-3 py-2 rounded-md bg-surface0 hover:bg-surface1 transition", className)} {...rest}> <button
<slot/> class={twMerge(
</button> "shadow-sm px-3 py-2 rounded-md bg-surface0 hover:bg-surface1 transition",
className,
)}
{...rest}
>
<slot />
</button>

View file

@ -1,8 +1,8 @@
--- ---
title: 'First post' title: "First post"
description: 'Lorem ipsum dolor sit amet' description: "Lorem ipsum dolor sit amet"
pubDate: 'Jul 08 2022' pubDate: "Jul 08 2022"
heroImage: '/blog-placeholder-3.jpg' heroImage: "/blog-placeholder-3.jpg"
--- ---
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet.

View file

@ -1,8 +1,8 @@
--- ---
title: 'Markdown Style Guide' title: "Markdown Style Guide"
description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.' description: "Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro."
pubDate: 'Jul 01 2022' pubDate: "Jul 01 2022"
heroImage: '/blog-placeholder-1.jpg' heroImage: "/blog-placeholder-1.jpg"
--- ---
Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro. Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.

View file

@ -1,8 +1,8 @@
--- ---
title: 'Second post' title: "Second post"
description: 'Lorem ipsum dolor sit amet' description: "Lorem ipsum dolor sit amet"
pubDate: 'Jul 15 2022' pubDate: "Jul 15 2022"
heroImage: '/blog-placeholder-4.jpg' heroImage: "/blog-placeholder-4.jpg"
--- ---
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet.

View file

@ -1,8 +1,8 @@
--- ---
title: 'Third post' title: "Third post"
description: 'Lorem ipsum dolor sit amet' description: "Lorem ipsum dolor sit amet"
pubDate: 'Jul 22 2022' pubDate: "Jul 22 2022"
heroImage: '/blog-placeholder-2.jpg' heroImage: "/blog-placeholder-2.jpg"
--- ---
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet.

View file

@ -1,8 +1,8 @@
--- ---
title: 'Using MDX' title: "Using MDX"
description: 'Lorem ipsum dolor sit amet' description: "Lorem ipsum dolor sit amet"
pubDate: 'Jul 02 2022' pubDate: "Jul 02 2022"
heroImage: '/blog-placeholder-5.jpg' heroImage: "/blog-placeholder-5.jpg"
--- ---
This theme comes with the [@astrojs/mdx](https://docs.astro.build/en/guides/integrations-guide/mdx/) integration installed and configured in your `astro.config.mjs` config file. If you prefer not to use MDX, you can disable support by removing the integration from your config file. This theme comes with the [@astrojs/mdx](https://docs.astro.build/en/guides/integrations-guide/mdx/) integration installed and configured in your `astro.config.mjs` config file. If you prefer not to use MDX, you can disable support by removing the integration from your config file.
@ -18,10 +18,10 @@ If you have existing content authored in MDX, this integration will hopefully ma
Here is how you import and use a UI component inside of MDX. Here is how you import and use a UI component inside of MDX.
When you open this page in the browser, you should see the clickable button below. When you open this page in the browser, you should see the clickable button below.
import HeaderLink from '../../components/HeaderLink.astro'; import HeaderLink from "../../components/HeaderLink.astro";
<HeaderLink href="#" onclick="alert('clicked!')"> <HeaderLink href="#" onclick="alert('clicked!')">
Embedded component in MDX Embedded component in MDX
</HeaderLink> </HeaderLink>
## More Links ## More Links

View file

@ -1,16 +1,16 @@
import { defineCollection, z } from 'astro:content'; import { defineCollection, z } from "astro:content";
const blog = defineCollection({ const blog = defineCollection({
type: 'content', type: "content",
// Type-check frontmatter using a schema // Type-check frontmatter using a schema
schema: z.object({ schema: z.object({
title: z.string(), title: z.string(),
description: z.string(), description: z.string(),
// Transform string to Date object // Transform string to Date object
pubDate: z.coerce.date(), pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(), updatedDate: z.coerce.date().optional(),
heroImage: z.string().optional(), heroImage: z.string().optional(),
}), }),
}); });
export const collections = { blog }; export const collections = { blog };

View file

@ -1,66 +1,76 @@
--- ---
import type { CollectionEntry } from 'astro:content'; import type { CollectionEntry } from "astro:content";
import BaseHead from '../components/BaseHead.astro'; import BaseHead from "../components/BaseHead.astro";
import Header from '../components/Header.astro'; import Header from "../components/Header.astro";
import Footer from '../components/Footer.astro'; import Footer from "../components/Footer.astro";
import FormattedDate from '../components/FormattedDate.astro'; import FormattedDate from "../components/FormattedDate.astro";
type Props = CollectionEntry<'blog'>['data']; type Props = CollectionEntry<"blog">["data"];
const { title, description, pubDate, updatedDate, heroImage } = Astro.props; const { title, description, pubDate, updatedDate, heroImage } = Astro.props;
--- ---
<html lang="en"> <html lang="en">
<head> <head>
<BaseHead title={title} description={description} /> <BaseHead title={title} description={description} />
<style> <style>
main { main {
width: calc(100% - 2em); width: calc(100% - 2em);
} }
.prose { .prose {
max-width: calc(100% - 2em); max-width: calc(100% - 2em);
color: rgb(var(--gray-dark)); color: rgb(var(--gray-dark));
} }
.title { .title {
padding: 1em 0; padding: 1em 0;
line-height: 1; line-height: 1;
} }
.title h1 { .title h1 {
margin: 0 0 0.5em 0; margin: 0 0 0.5em 0;
} }
.date { .date {
margin-bottom: 0.5em; margin-bottom: 0.5em;
color: rgb(var(--gray)); color: rgb(var(--gray));
} }
</style> </style>
</head> </head>
<body> <body>
<Header /> <Header />
<main class="max-w-full m-0"> <main class="max-w-full m-0">
<article> <article>
<div class="w-full"> <div class="w-full">
{heroImage && <img width={1020} height={510} src={heroImage} class="block m-0 rounded-md shadow-sm" alt="" />} {
</div> heroImage && (
<div class="w-[720px] m-auto p-1"> <img
<div class="mb-1 text-center"> width={1020}
<div class="date"> height={510}
<FormattedDate date={pubDate} /> src={heroImage}
{ class="block m-0 rounded-md shadow-sm"
updatedDate && ( alt=""
<div class="italic"> />
Last updated on <FormattedDate date={updatedDate} /> )
</div> }
) </div>
} <div class="w-[720px] m-auto p-1">
</div> <div class="mb-1 text-center">
<h1>{title}</h1> <div class="date">
<hr /> <FormattedDate date={pubDate} />
</div> {
<slot /> updatedDate && (
</div> <div class="italic">
</article> Last updated on <FormattedDate date={updatedDate} />
</main> </div>
<Footer /> )
</body> }
</div>
<h1>{title}</h1>
<hr />
</div>
<slot />
</div>
</article>
</main>
<Footer />
</body>
</html> </html>

View file

@ -1,62 +1,72 @@
--- ---
import Layout from '../layouts/BlogPost.astro'; import Layout from "../layouts/BlogPost.astro";
--- ---
<Layout <Layout
title="About Me" title="About Me"
description="Lorem ipsum dolor sit amet" description="Lorem ipsum dolor sit amet"
pubDate={new Date('August 08 2021')} pubDate={new Date("August 08 2021")}
heroImage="/blog-placeholder-about.jpg" heroImage="/blog-placeholder-about.jpg"
> >
<p> <p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo
viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis
adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In
et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat.
vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu
sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim.
</p> Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed
vulputate mi. Dictumst quisque sagittis purus sit amet.
</p>
<p> <p>
Morbi tristique senectus et netus. Id semper risus in hendrerit gravida rutrum quisque non Morbi tristique senectus et netus. Id semper risus in hendrerit gravida
tellus. Habitasse platea dictumst quisque sagittis purus sit amet. Tellus molestie nunc non rutrum quisque non tellus. Habitasse platea dictumst quisque sagittis purus
blandit massa. Cursus vitae congue mauris rhoncus. Accumsan tortor posuere ac ut. Fringilla urna sit amet. Tellus molestie nunc non blandit massa. Cursus vitae congue mauris
porttitor rhoncus dolor. Elit ullamcorper dignissim cras tincidunt lobortis. In cursus turpis rhoncus. Accumsan tortor posuere ac ut. Fringilla urna porttitor rhoncus
massa tincidunt dui ut ornare lectus. Integer feugiat scelerisque varius morbi enim nunc. dolor. Elit ullamcorper dignissim cras tincidunt lobortis. In cursus turpis
Bibendum neque egestas congue quisque egestas diam. Cras ornare arcu dui vivamus arcu felis massa tincidunt dui ut ornare lectus. Integer feugiat scelerisque varius
bibendum. Dignissim suspendisse in est ante in nibh mauris. Sed tempus urna et pharetra pharetra morbi enim nunc. Bibendum neque egestas congue quisque egestas diam. Cras
massa massa ultricies mi. ornare arcu dui vivamus arcu felis bibendum. Dignissim suspendisse in est
</p> ante in nibh mauris. Sed tempus urna et pharetra pharetra massa massa
ultricies mi.
</p>
<p> <p>
Mollis nunc sed id semper risus in. Convallis a cras semper auctor neque. Diam sit amet nisl Mollis nunc sed id semper risus in. Convallis a cras semper auctor neque.
suscipit. Lacus viverra vitae congue eu consequat ac felis donec. Egestas integer eget aliquet Diam sit amet nisl suscipit. Lacus viverra vitae congue eu consequat ac
nibh praesent tristique magna sit amet. Eget magna fermentum iaculis eu non diam. In vitae felis donec. Egestas integer eget aliquet nibh praesent tristique magna sit
turpis massa sed elementum. Tristique et egestas quis ipsum suspendisse ultrices. Eget lorem amet. Eget magna fermentum iaculis eu non diam. In vitae turpis massa sed
dolor sed viverra ipsum. Vel turpis nunc eget lorem dolor sed viverra. Posuere ac ut consequat elementum. Tristique et egestas quis ipsum suspendisse ultrices. Eget lorem
semper viverra nam. Laoreet suspendisse interdum consectetur libero id faucibus. Diam phasellus dolor sed viverra ipsum. Vel turpis nunc eget lorem dolor sed viverra.
vestibulum lorem sed risus ultricies tristique. Rhoncus dolor purus non enim praesent elementum Posuere ac ut consequat semper viverra nam. Laoreet suspendisse interdum
facilisis. Ultrices tincidunt arcu non sodales neque. Tempus egestas sed sed risus pretium quam consectetur libero id faucibus. Diam phasellus vestibulum lorem sed risus
vulputate. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare. Fringilla ultricies tristique. Rhoncus dolor purus non enim praesent elementum
urna porttitor rhoncus dolor purus non. Amet dictum sit amet justo donec enim. facilisis. Ultrices tincidunt arcu non sodales neque. Tempus egestas sed sed
</p> risus pretium quam vulputate. Viverra suspendisse potenti nullam ac tortor
vitae purus faucibus ornare. Fringilla urna porttitor rhoncus dolor purus
non. Amet dictum sit amet justo donec enim.
</p>
<p> <p>
Mattis ullamcorper velit sed ullamcorper morbi tincidunt. Tortor posuere ac ut consequat semper Mattis ullamcorper velit sed ullamcorper morbi tincidunt. Tortor posuere ac
viverra. Tellus mauris a diam maecenas sed enim ut sem viverra. Venenatis urna cursus eget nunc ut consequat semper viverra. Tellus mauris a diam maecenas sed enim ut sem
scelerisque viverra mauris in. Arcu ac tortor dignissim convallis aenean et tortor at. Curabitur viverra. Venenatis urna cursus eget nunc scelerisque viverra mauris in. Arcu
gravida arcu ac tortor dignissim convallis aenean et tortor. Egestas tellus rutrum tellus ac tortor dignissim convallis aenean et tortor at. Curabitur gravida arcu ac
pellentesque eu. Fusce ut placerat orci nulla pellentesque dignissim enim sit amet. Ut enim tortor dignissim convallis aenean et tortor. Egestas tellus rutrum tellus
blandit volutpat maecenas volutpat blandit aliquam etiam. Id donec ultrices tincidunt arcu. Id pellentesque eu. Fusce ut placerat orci nulla pellentesque dignissim enim
cursus metus aliquam eleifend mi. sit amet. Ut enim blandit volutpat maecenas volutpat blandit aliquam etiam.
</p> Id donec ultrices tincidunt arcu. Id cursus metus aliquam eleifend mi.
</p>
<p> <p>
Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus imperdiet. Id porta Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus
nibh venenatis cras sed felis eget velit. Ipsum a arcu cursus vitae. Facilisis magna etiam imperdiet. Id porta nibh venenatis cras sed felis eget velit. Ipsum a arcu
tempor orci eu lobortis elementum. Tincidunt dui ut ornare lectus sit. Quisque non tellus orci cursus vitae. Facilisis magna etiam tempor orci eu lobortis elementum.
ac. Blandit libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed pulvinar Tincidunt dui ut ornare lectus sit. Quisque non tellus orci ac. Blandit
proin gravida. Egestas integer eget aliquet nibh praesent tristique magna. libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed
</p> pulvinar proin gravida. Egestas integer eget aliquet nibh praesent tristique
magna.
</p>
</Layout> </Layout>

View file

@ -1,20 +1,20 @@
--- ---
import { type CollectionEntry, getCollection } from 'astro:content'; import { type CollectionEntry, getCollection } from "astro:content";
import BlogPost from '../../layouts/BlogPost.astro'; import BlogPost from "../../layouts/BlogPost.astro";
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getCollection('blog'); const posts = await getCollection("blog");
return posts.map((post) => ({ return posts.map((post) => ({
params: { slug: post.slug }, params: { slug: post.slug },
props: post, props: post,
})); }));
} }
type Props = CollectionEntry<'blog'>; type Props = CollectionEntry<"blog">;
const post = Astro.props; const post = Astro.props;
const { Content } = await post.render(); const { Content } = await post.render();
--- ---
<BlogPost {...post.data}> <BlogPost {...post.data}>
<Content /> <Content />
</BlogPost> </BlogPost>

View file

@ -1,42 +1,47 @@
--- ---
import BaseHead from '../../components/BaseHead.astro'; import BaseHead from "../../components/BaseHead.astro";
import Header from '../../components/Header.astro'; import Header from "../../components/Header.astro";
import Footer from '../../components/Footer.astro'; import Footer from "../../components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts'; import { SITE_TITLE, SITE_DESCRIPTION } from "../../consts";
import { getCollection } from 'astro:content'; import { getCollection } from "astro:content";
import FormattedDate from '../../components/FormattedDate.astro'; import FormattedDate from "../../components/FormattedDate.astro";
const posts = (await getCollection('blog')).sort( const posts = (await getCollection("blog")).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf(),
); );
--- ---
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
</head> </head>
<body> <body>
<Header /> <Header />
<main> <main>
<section> <section>
<ul> <ul>
{ {
posts.map((post) => ( posts.map((post) => (
<li> <li>
<a href={`/blog/${post.slug}/`}> <a href={`/blog/${post.slug}/`}>
<img width={720} height={360} src={post.data.heroImage} alt="" /> <img
<h4 class="title">{post.data.title}</h4> width={720}
<p class="date"> height={360}
<FormattedDate date={post.data.pubDate} /> src={post.data.heroImage}
</p> alt=""
</a> />
</li> <h4 class="title">{post.data.title}</h4>
)) <p class="date">
} <FormattedDate date={post.data.pubDate} />
</ul> </p>
</section> </a>
</main> </li>
<Footer /> ))
</body> }
</ul>
</section>
</main>
<Footer />
</body>
</html> </html>

View file

@ -1,26 +1,26 @@
--- ---
import BaseHead from '../components/BaseHead.astro'; import BaseHead from "../components/BaseHead.astro";
import Header from '../components/Header.astro'; import Header from "../components/Header.astro";
import Footer from '../components/Footer.astro'; import Footer from "../components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
import Button from '../components/ui/Button.astro'; import Button from "../components/ui/Button.astro";
--- ---
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
</head> </head>
<body> <body>
<Header /> <Header />
<main class="bg-base text-text px-12 py-12"> <main class="bg-base text-text px-12 py-12">
<div class="flex flex-col gap-4 w-1/3"> <div class="flex flex-col gap-4 w-1/3">
<h1 class="text-5xl font-bold">Hi there! 👋</h1> <h1 class="text-5xl font-bold">Hi there! 👋</h1>
<p> <p>
Hey there! I'm Mahad, a software engineer and a tech enthusiast. Hey there! I'm Mahad, a software engineer and a tech enthusiast. I
I love to build things and share my knowledge with others! love to build things and share my knowledge with others! I'm currently
I'm currently working on a few projects and writing blog posts about them. working on a few projects and writing blog posts about them. Stay
Stay tuned! tuned!
</p> </p>
<div class="flex flex-row gap-2"> <div class="flex flex-row gap-2">
<Button> <Button>
@ -28,7 +28,7 @@ import Button from '../components/ui/Button.astro';
</Button> </Button>
</div> </div>
</div> </div>
</main> </main>
<Footer /> <Footer />
</body> </body>
</html> </html>

View file

@ -1,16 +1,16 @@
import rss from '@astrojs/rss'; import rss from "@astrojs/rss";
import { getCollection } from 'astro:content'; import { getCollection } from "astro:content";
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
export async function GET(context) { export async function GET(context) {
const posts = await getCollection('blog'); const posts = await getCollection("blog");
return rss({ return rss({
title: SITE_TITLE, title: SITE_TITLE,
description: SITE_DESCRIPTION, description: SITE_DESCRIPTION,
site: context.site, site: context.site,
items: posts.map((post) => ({ items: posts.map((post) => ({
...post.data, ...post.data,
link: `/blog/${post.slug}/`, link: `/blog/${post.slug}/`,
})), })),
}); });
} }

View file

@ -1,12 +1,12 @@
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
export default { export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
theme: { theme: {
extend: {}, extend: {},
}, },
plugins: [ plugins: [
require("@catppuccin/tailwindcss")({ require("@catppuccin/tailwindcss")({
defaultFlavour: "macchiato" defaultFlavour: "macchiato",
}) }),
], ],
} };

View file

@ -3,4 +3,4 @@
"compilerOptions": { "compilerOptions": {
"strictNullChecks": true "strictNullChecks": true
} }
} }