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 mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
integrations: [mdx(), sitemap(), tailwind()]
site: "https://example.com",
integrations: [mdx(), sitemap(), tailwind()],
});

BIN
bun.lockb

Binary file not shown.

View file

@ -7,18 +7,23 @@
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"format": "prettier --write .",
"astro": "astro"
},
"dependencies": { "tailwind-merge": "^2.3.0" },
"dependencies": {
"tailwind-merge": "^2.3.0"
},
"devDependencies": {
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3",
"@catppuccin/tailwindcss": "^0.1.6",
"@astrojs/check": "^0.7.0",
"@astrojs/mdx": "^3.1.2",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"@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,7 +1,7 @@
---
// Import the global.css file here so that it is included on
// all pages through the use of the <BaseHead /> component.
import '../styles/global.css';
import "../styles/global.css";
interface Props {
title: string;
@ -11,7 +11,7 @@ interface Props {
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 -->
@ -21,8 +21,20 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props;
<meta name="generator" content={Astro.generator} />
<!-- Font preloads -->
<link 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 />
<link
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 -->
<link rel="canonical" href={canonicalURL} />

View file

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

View file

@ -1,12 +1,14 @@
---
import HeaderLink from './HeaderLink.astro';
import { SITE_TITLE } from '../consts';
import Twitter from './socialIcons/Twitter.astro';
import GitHub from './socialIcons/GitHub.astro';
import HeaderLink from "./HeaderLink.astro";
import { SITE_TITLE } from "../consts";
import Twitter from "./socialIcons/Twitter.astro";
import GitHub from "./socialIcons/GitHub.astro";
---
<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
class="px-3 py-2 flex items-center gap-2 w-full border-b-[2px] border-surface0 shadow-sm bg-crust text-text"
>
<h2 class="font-semibold mx-3"><a href="/">{SITE_TITLE}</a></h2>
<div class="flex flew-row gap-3">
<HeaderLink href="/">Home</HeaderLink>

View file

@ -1,13 +1,13 @@
---
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 { pathname } = Astro.url;
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}>

View file

@ -1,8 +1,14 @@
---
import {twMerge} from "tailwind-merge";
import { twMerge } from "tailwind-merge";
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}>
<slot/>
<button
class={twMerge(
"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'
description: 'Lorem ipsum dolor sit amet'
pubDate: 'Jul 08 2022'
heroImage: '/blog-placeholder-3.jpg'
title: "First post"
description: "Lorem ipsum dolor sit amet"
pubDate: "Jul 08 2022"
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.

View file

@ -1,8 +1,8 @@
---
title: 'Markdown Style Guide'
description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.'
pubDate: 'Jul 01 2022'
heroImage: '/blog-placeholder-1.jpg'
title: "Markdown Style Guide"
description: "Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro."
pubDate: "Jul 01 2022"
heroImage: "/blog-placeholder-1.jpg"
---
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'
description: 'Lorem ipsum dolor sit amet'
pubDate: 'Jul 15 2022'
heroImage: '/blog-placeholder-4.jpg'
title: "Second post"
description: "Lorem ipsum dolor sit amet"
pubDate: "Jul 15 2022"
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.

View file

@ -1,8 +1,8 @@
---
title: 'Third post'
description: 'Lorem ipsum dolor sit amet'
pubDate: 'Jul 22 2022'
heroImage: '/blog-placeholder-2.jpg'
title: "Third post"
description: "Lorem ipsum dolor sit amet"
pubDate: "Jul 22 2022"
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.

View file

@ -1,8 +1,8 @@
---
title: 'Using MDX'
description: 'Lorem ipsum dolor sit amet'
pubDate: 'Jul 02 2022'
heroImage: '/blog-placeholder-5.jpg'
title: "Using MDX"
description: "Lorem ipsum dolor sit amet"
pubDate: "Jul 02 2022"
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.
@ -18,7 +18,7 @@ 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.
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!')">
Embedded component in MDX

View file

@ -1,7 +1,7 @@
import { defineCollection, z } from 'astro:content';
import { defineCollection, z } from "astro:content";
const blog = defineCollection({
type: 'content',
type: "content",
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),

View file

@ -1,11 +1,11 @@
---
import type { CollectionEntry } from 'astro:content';
import BaseHead from '../components/BaseHead.astro';
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
import FormattedDate from '../components/FormattedDate.astro';
import type { CollectionEntry } from "astro:content";
import BaseHead from "../components/BaseHead.astro";
import Header from "../components/Header.astro";
import Footer from "../components/Footer.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;
---
@ -40,7 +40,17 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props;
<main class="max-w-full m-0">
<article>
<div class="w-full">
{heroImage && <img width={1020} height={510} src={heroImage} class="block m-0 rounded-md shadow-sm" alt="" />}
{
heroImage && (
<img
width={1020}
height={510}
src={heroImage}
class="block m-0 rounded-md shadow-sm"
alt=""
/>
)
}
</div>
<div class="w-[720px] m-auto p-1">
<div class="mb-1 text-center">

View file

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

View file

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

View file

@ -1,13 +1,13 @@
---
import BaseHead from '../../components/BaseHead.astro';
import Header from '../../components/Header.astro';
import Footer from '../../components/Footer.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
import BaseHead from "../../components/BaseHead.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../../consts";
import { getCollection } from "astro:content";
import FormattedDate from "../../components/FormattedDate.astro";
const posts = (await getCollection('blog')).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
const posts = (await getCollection("blog")).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf(),
);
---
@ -25,7 +25,12 @@ const posts = (await getCollection('blog')).sort(
posts.map((post) => (
<li>
<a href={`/blog/${post.slug}/`}>
<img width={720} height={360} src={post.data.heroImage} alt="" />
<img
width={720}
height={360}
src={post.data.heroImage}
alt=""
/>
<h4 class="title">{post.data.title}</h4>
<p class="date">
<FormattedDate date={post.data.pubDate} />

View file

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

View file

@ -1,9 +1,9 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
export async function GET(context) {
const posts = await getCollection('blog');
const posts = await getCollection("blog");
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,

View file

@ -1,12 +1,12 @@
/** @type {import('tailwindcss').Config} */
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: {
extend: {},
},
plugins: [
require("@catppuccin/tailwindcss")({
defaultFlavour: "macchiato"
})
defaultFlavour: "macchiato",
}),
],
}
};