build!: upgrade to Tailwind CSS v4

This commit is contained in:
satnaing
2025-02-25 20:35:00 +07:00
committed by Sat Naing
parent 360278277d
commit 172e14b5f4
36 changed files with 7631 additions and 10633 deletions
+13 -25
View File
@@ -1,22 +1,25 @@
---
import { SITE } from "@config";
import Layout from "@layouts/Layout.astro";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import LinkButton from "@components/LinkButton.astro";
import Layout from "@/layouts/Layout.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import LinkButton from "@/components/LinkButton.astro";
import { SITE } from "@/config";
---
<Layout title={`404 Not Found | ${SITE.title}`}>
<Header />
<main id="main-content">
<div class="not-found-wrapper">
<h1>404</h1>
<main
id="main-content"
class="mx-auto flex max-w-3xl flex-1 items-center justify-center"
>
<div class="mb-14 flex flex-col items-center justify-center">
<h1 class="text-9xl font-bold text-accent">404</h1>
<span aria-hidden="true">¯\_(ツ)_/¯</span>
<p>Page Not Found</p>
<p class="mt-4 text-2xl sm:text-3xl">Page Not Found</p>
<LinkButton
href="/"
className="my-6 text-lg underline decoration-dashed underline-offset-8"
class="my-6 text-lg underline decoration-dashed underline-offset-8"
>
Go back home
</LinkButton>
@@ -25,18 +28,3 @@ import LinkButton from "@components/LinkButton.astro";
<Footer />
</Layout>
<style>
#main-content {
@apply mx-auto flex max-w-3xl flex-1 items-center justify-center;
}
.not-found-wrapper {
@apply mb-14 flex flex-col items-center justify-center;
}
.not-found-wrapper h1 {
@apply text-9xl font-bold text-skin-accent;
}
.not-found-wrapper p {
@apply mt-4 text-2xl sm:text-3xl;
}
</style>
+29 -24
View File
@@ -1,12 +1,12 @@
---
import { getCollection } from "astro:content";
import Card from "@components/Card";
import Footer from "@components/Footer.astro";
import Header from "@components/Header.astro";
import { SITE } from "@config";
import Layout from "@layouts/Layout.astro";
import Main from "@layouts/Main.astro";
import getPostsByGroupCondition from "@utils/getPostsByGroupCondition";
import Main from "@/layouts/Main.astro";
import Layout from "@/layouts/Layout.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import Card from "@/components/Card";
import getPostsByGroupCondition from "@/utils/getPostsByGroupCondition";
import { SITE } from "@/config";
// Redirect to 404 page if `showArchives` config is false
if (!SITE.showArchives) {
@@ -15,24 +15,26 @@ if (!SITE.showArchives) {
const posts = await getCollection("blog", ({ data }) => !data.draft);
const MonthMap: Record<string, string> = {
"1": "January",
"2": "February",
"3": "March",
"4": "April",
"5": "May",
"6": "June",
"7": "July",
"8": "August",
"9": "September",
"10": "October",
"11": "November",
"12": "December",
};
const months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
const backUrl = SITE.showBackButton ? `?from=${Astro.url.pathname}` : "/";
---
<Layout title={`Archives | ${SITE.title}`}>
<Header activeNav="archives" />
<Header />
<Main pageTitle="Archives" pageDesc="All the articles I've archived.">
{
Object.entries(
@@ -55,7 +57,7 @@ const MonthMap: Record<string, string> = {
.map(([month, monthGroup]) => (
<div class="flex flex-col sm:flex-row">
<div class="mt-6 min-w-36 text-lg sm:my-6">
<span class="font-bold">{MonthMap[month]}</span>
<span class="font-bold">{months[Number(month) - 1]}</span>
<sup class="text-xs">{monthGroup.length}</sup>
</div>
<ul>
@@ -70,7 +72,10 @@ const MonthMap: Record<string, string> = {
)
)
.map(({ data, id }) => (
<Card href={`/posts/${id}`} frontmatter={data} />
<Card
href={`/posts/${id}${backUrl}`}
frontmatter={data}
/>
))}
</ul>
</div>
+33 -75
View File
@@ -1,43 +1,44 @@
---
import { getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import LinkButton from "@components/LinkButton.astro";
import Hr from "@components/Hr.astro";
import Card from "@components/Card";
import Socials from "@components/Socials.astro";
import getSortedPosts from "@utils/getSortedPosts";
import { SITE, SOCIALS } from "@config";
import Layout from "@/layouts/Layout.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import Socials from "@/components/Socials.astro";
import LinkButton from "@/components/LinkButton.astro";
import Card from "@/components/Card";
import Hr from "@/components/Hr.astro";
import getSortedPosts from "@/utils/getSortedPosts";
import IconRss from "@/assets/icons/IconRss.svg";
import IconArrowRight from "@/assets/icons/IconArrowRight.svg";
import { SITE } from "@/config";
import { SOCIALS } from "@/constants";
const posts = await getCollection("blog");
const sortedPosts = getSortedPosts(posts);
const featuredPosts = sortedPosts.filter(({ data }) => data.featured);
const recentPosts = sortedPosts.filter(({ data }) => !data.featured);
const socialCount = SOCIALS.filter(social => social.active).length;
---
<Layout>
<Header />
<main id="main-content">
<section id="hero">
<h1>Mingalaba</h1>
<section id="hero" class="pt-8 pb-6">
<h1 class="my-4 inline-block text-4xl font-bold sm:my-8 sm:text-5xl">
Mingalaba
</h1>
<a
target="_blank"
href="/rss.xml"
class="rss-link"
class="inline-block"
aria-label="rss feed"
title="RSS Feed"
>
<svg xmlns="http://www.w3.org/2000/svg" class="rss-icon"
><path
d="M19 20.001C19 11.729 12.271 5 4 5v2c7.168 0 13 5.832 13 13.001h2z"
></path><path
d="M12 20.001h2C14 14.486 9.514 10 4 10v2c4.411 0 8 3.589 8 8.001z"
></path><circle cx="6" cy="18" r="2"></circle>
</svg>
<IconRss
width={20}
height={20}
class="scale-125 stroke-accent stroke-3"
/>
<span class="sr-only">RSS Feed</span>
</a>
@@ -47,10 +48,10 @@ const socialCount = SOCIALS.filter(social => social.active).length;
out of the box. Light and dark mode are supported by default. Moreover,
additional color schemes can also be configured.
</p>
<p>
<p class="mt-2">
Read the blog posts or check
<LinkButton
className="underline decoration-dashed underline-offset-4 hover:text-skin-accent"
class="underline decoration-dashed underline-offset-4 hover:text-accent"
href="https://github.com/satnaing/astro-paper#readme"
>
README
@@ -58,9 +59,9 @@ const socialCount = SOCIALS.filter(social => social.active).length;
</p>
{
// only display if at least one social link is enabled
socialCount > 0 && (
<div class="social-wrapper">
<div class="social-links">Social Links:</div>
SOCIALS.length > 0 && (
<div class="mt-4 flex flex-col sm:flex-row sm:items-center">
<div class="mr-2 mb-1 whitespace-nowrap sm:mb-0">Social Links:</div>
<Socials />
</div>
)
@@ -72,8 +73,8 @@ const socialCount = SOCIALS.filter(social => social.active).length;
{
featuredPosts.length > 0 && (
<>
<section id="featured">
<h2>Featured</h2>
<section id="featured" class="pt-12 pb-6">
<h2 class="text-2xl font-semibold tracking-wide">Featured</h2>
<ul>
{featuredPosts.map(({ data, id }) => (
<Card
@@ -91,8 +92,8 @@ const socialCount = SOCIALS.filter(social => social.active).length;
{
recentPosts.length > 0 && (
<section id="recent-posts">
<h2>Recent Posts</h2>
<section id="recent-posts" class="pt-12 pb-6">
<h2 class="text-2xl font-semibold tracking-wide">Recent Posts</h2>
<ul>
{recentPosts.map(
({ data, id }, index) =>
@@ -109,55 +110,12 @@ const socialCount = SOCIALS.filter(social => social.active).length;
)
}
<div class="all-posts-btn-wrapper">
<div class="my-8 text-center">
<LinkButton href="/posts/">
All Posts
<svg xmlns="http://www.w3.org/2000/svg"
><path
d="m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z"
></path>
</svg>
<IconArrowRight class="inline-block" />
</LinkButton>
</div>
</main>
<Footer />
</Layout>
<style>
/* ===== Hero Section ===== */
#hero {
@apply pb-6 pt-8;
}
#hero h1 {
@apply my-4 inline-block text-3xl font-bold sm:my-8 sm:text-5xl;
}
#hero .rss-link {
@apply mb-6;
}
#hero .rss-icon {
@apply mb-2 h-6 w-6 scale-110 fill-skin-accent sm:mb-3 sm:scale-125;
}
#hero p {
@apply my-2;
}
.social-wrapper {
@apply mt-4 flex flex-col sm:flex-row sm:items-center;
}
.social-links {
@apply mb-1 mr-2 whitespace-nowrap sm:mb-0;
}
/* ===== Featured & Recent Posts Sections ===== */
#featured,
#recent-posts {
@apply pb-6 pt-12;
}
#featured h2,
#recent-posts h2 {
@apply text-2xl font-semibold tracking-wide;
}
.all-posts-btn-wrapper {
@apply my-8 text-center;
}
</style>
+26 -4
View File
@@ -1,9 +1,14 @@
---
import { SITE } from "@config";
import Posts from "@layouts/Posts.astro";
import type { GetStaticPaths } from "astro";
import { getCollection } from "astro:content";
import getSortedPosts from "@utils/getSortedPosts";
import Main from "@/layouts/Main.astro";
import Layout from "@/layouts/Layout.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import Card from "@/components/Card";
import Pagination from "@/components/Pagination.astro";
import getSortedPosts from "@/utils/getSortedPosts";
import { SITE } from "@/config";
export const getStaticPaths = (async ({ paginate }) => {
const posts = await getCollection("blog", ({ data }) => !data.draft);
@@ -11,6 +16,23 @@ export const getStaticPaths = (async ({ paginate }) => {
}) satisfies GetStaticPaths;
const { page } = Astro.props;
const backUrl = SITE.showBackButton ? `?from=${Astro.url.pathname}` : "/";
---
<Posts {page} />
<Layout title={`Posts | ${SITE.title}`}>
<Header />
<Main pageTitle="Posts" pageDesc="All the articles I've posted.">
<ul>
{
page.data.map(({ data, id }) => (
<Card href={`/posts/${id}${backUrl}`} frontmatter={data} />
))
}
</ul>
</Main>
<Pagination {page} />
<Footer noMarginTop={page.lastPage > 1} />
</Layout>
+11 -9
View File
@@ -1,12 +1,12 @@
---
import { getCollection } from "astro:content";
import { SITE } from "@config";
import Layout from "@layouts/Layout.astro";
import Main from "@layouts/Main.astro";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import SearchBar from "@components/Search";
import getSortedPosts from "@utils/getSortedPosts";
import Main from "@/layouts/Main.astro";
import Layout from "@/layouts/Layout.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import SearchBar from "@/components/SearchBar";
import getSortedPosts from "@/utils/getSortedPosts";
import { SITE } from "@/config";
// Retrieve all published articles
const posts = await getCollection("blog", ({ data }) => !data.draft);
@@ -19,12 +19,14 @@ const searchList = sortedPosts.map(({ data, id }) => ({
data,
slug: id,
}));
const backUrl = SITE.showBackButton ? `?from=${Astro.url.pathname}` : "/";
---
<Layout title={`Search | ${SITE.title}`}>
<Header activeNav="search" />
<Header />
<Main pageTitle="Search" pageDesc="Search any article ...">
<SearchBar client:load searchList={searchList} />
<SearchBar client:load searchList={searchList} backUrl={backUrl} />
</Main>
<Footer />
</Layout>
+32 -5
View File
@@ -1,10 +1,15 @@
---
import { getCollection } from "astro:content";
import TagPosts from "@layouts/TagPosts.astro";
import getUniqueTags from "@utils/getUniqueTags";
import getPostsByTag from "@utils/getPostsByTag";
import type { GetStaticPathsOptions } from "astro";
import { SITE } from "@config";
import Main from "@/layouts/Main.astro";
import Layout from "@/layouts/Layout.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import Card from "@/components/Card";
import Pagination from "@/components/Pagination.astro";
import getUniqueTags from "@/utils/getUniqueTags";
import getPostsByTag from "@/utils/getPostsByTag";
import { SITE } from "@/config";
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
const posts = await getCollection("blog");
@@ -24,6 +29,28 @@ export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
const params = Astro.params;
const { tag } = params;
const { page, tagName } = Astro.props;
const backUrl = SITE.showBackButton ? `?from=${Astro.url.pathname}` : "/";
---
<TagPosts {page} {tag} {tagName} />
<Layout title={`Tag: ${tagName} | ${SITE.title}`}>
<Header />
<Main
pageTitle={[`Tag:`, `${tagName}`]}
titleTransition={tag}
pageDesc={`All the articles with the tag "${tagName}".`}
>
<h1 slot="title" transition:name={tag}>{`Tag:${tag}`}</h1>
<ul>
{
page.data.map(({ data, id }) => (
<Card href={`/posts/${id}${backUrl}`} frontmatter={data} />
))
}
</ul>
</Main>
<Pagination {page} />
<Footer noMarginTop={page.lastPage > 1} />
</Layout>
+3 -3
View File
@@ -1,10 +1,10 @@
---
import { getCollection } from "astro:content";
import Main from "@/layouts/Main.astro";
import Layout from "@/layouts/Layout.astro";
import Tag from "@/components/Tag.astro";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
import Main from "@/layouts/Main.astro";
import Tag from "@/components/Tag.astro";
import getUniqueTags from "@/utils/getUniqueTags";
import { SITE } from "@/config";
@@ -14,7 +14,7 @@ let tags = getUniqueTags(posts);
---
<Layout title={`Tags | ${SITE.title}`}>
<Header activeNav="tags" />
<Header />
<Main pageTitle="Tags" pageDesc="All the tags used in posts.">
<ul>
{tags.map(({ tag, tagName }) => <Tag {tag} {tagName} size="lg" />)}