Merge pull request #3 from liyunze-coding/tailwind-v4

updated to tailwind v4
This commit is contained in:
RythonDev 2025-06-18 21:51:21 +10:00 committed by GitHub
commit 26b35110df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 858 additions and 1189 deletions

View file

@ -1,25 +1,31 @@
import { defineConfig } from "astro/config"; import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import mdx from "@astrojs/mdx"; import mdx from "@astrojs/mdx";
import react from "@astrojs/react"; import react from "@astrojs/react";
import expressiveCode from "astro-expressive-code"; import expressiveCode from "astro-expressive-code";
import remarkDirective from "remark-directive"; import remarkDirective from "remark-directive";
import remarkCalloutDirectives from "./src/assets/plugins/remark-callout-directives-customized.js"; import remarkCalloutDirectives from "./src/assets/plugins/remark-callout-directives-customized.js";
import tailwindcss from "@tailwindcss/vite";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
integrations: [ integrations: [
tailwind(), expressiveCode(),
expressiveCode(), mdx({
mdx({ remarkPlugins: [remarkDirective, remarkCalloutDirectives],
remarkPlugins: [remarkDirective, remarkCalloutDirectives], }),
}), react(),
react(), ],
],
server: { server: {
port: 4321, port: 4321,
}, },
markdown: {
remarkPlugins: [remarkDirective, remarkCalloutDirectives], markdown: {
}, remarkPlugins: [remarkDirective, remarkCalloutDirectives],
},
vite: {
plugins: [tailwindcss()],
},
}); });

1785
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -12,8 +12,8 @@
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.2.5", "@astrojs/mdx": "^4.2.5",
"@astrojs/react": "^3.6.2", "@astrojs/react": "^3.6.2",
"@astrojs/tailwind": "^5.1.2",
"@astrojs/ts-plugin": "^1.10.4", "@astrojs/ts-plugin": "^1.10.4",
"@tailwindcss/vite": "^4.1.10",
"@types/react": "^18.2.65", "@types/react": "^18.2.65",
"@types/react-dom": "^18.2.22", "@types/react-dom": "^18.2.22",
"@vercel/analytics": "^1.0.1", "@vercel/analytics": "^1.0.1",
@ -21,11 +21,12 @@
"astro-expressive-code": "^0.41.2", "astro-expressive-code": "^0.41.2",
"clsx": "^2.1.0", "clsx": "^2.1.0",
"framer-motion": "^11.0.12", "framer-motion": "^11.0.12",
"motion": "^12.18.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"remark-directive": "^3.0.0", "remark-directive": "^3.0.0",
"tailwind-merge": "^2.2.1", "tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1", "tailwindcss": "^4.1.10",
"typescript": "^5.4.3" "typescript": "^5.4.3"
}, },
"devDependencies": { "devDependencies": {

View file

@ -34,14 +34,20 @@ export async function setup() {
// Define the order of categories // Define the order of categories
let categoryOrder = ["Get Started", "Guide", "Tutorials"]; let categoryOrder = ["Get Started", "Guide", "Tutorials"];
const getStartedFiles = Object.values(import.meta.glob("../../pages/get-started/*", { eager: true })); const getStartedFiles = Object.values(
const guideFiles = Object.values(import.meta.glob("../../pages/guide/*", { eager: true })); import.meta.glob("../../pages/get-started/*", { eager: true })
const tutorialFiles = Object.values(import.meta.glob("../../pages/tutorials/*", { eager: true })); );
const guideFiles = Object.values(
import.meta.glob("../../pages/guide/*", { eager: true })
);
const tutorialFiles = Object.values(
import.meta.glob("../../pages/tutorials/*", { eager: true })
);
let markdownFiles: MarkdownFile[] = [ let markdownFiles: MarkdownFile[] = [
...(getStartedFiles as MarkdownFile[]), ...(getStartedFiles as MarkdownFile[]),
...(guideFiles as MarkdownFile[]), ...(guideFiles as MarkdownFile[]),
...(tutorialFiles as MarkdownFile[]) ...(tutorialFiles as MarkdownFile[]),
]; ];
let navigation: Navigation = {}; let navigation: Navigation = {};
@ -122,10 +128,10 @@ const { showHome } = Astro.props;
</div> </div>
<ul class="list-disc list-outside font-normal"> <ul class="list-disc list-outside font-normal">
{links.map((link) => ( {links.map((link) => (
<li class="mb-1 pl-0"> <li class="mb-1 pl-0 ml-5">
<a <a
href={link.url} href={link.url}
class={`no-target-blank px-2 rounded-md w-full transition-colors duration-150 hover:no-underline hover:text-white ${isCurrentUrl(link.url) ? "text-black bg-primary-green" : "text-gray-400 bg-none"}`} class={`no-target-blank w-full inline-block px-2 py-1 rounded-md transition-colors duration-150 hover:no-underline hover:text-white ${isCurrentUrl(link.url) ? "text-black bg-primary-green" : "text-gray-400 bg-none"}`}
> >
{link.title} {link.title}
</a> </a>

View file

@ -2,7 +2,8 @@
<div class="text-center text-4xl lg:text-6xl font-bold"> <div class="text-center text-4xl lg:text-6xl font-bold">
<span class="text-slate-200">Getting started with</span> <span class="text-slate-200">Getting started with</span>
<div <div
class="bg-clip-text text-transparent bg-hero-gradient animate-gradient py-1 lg:py-3 bg-[length:300%]" id="coworking-streams"
class="text-transparent animate-gradient py-1 lg:py-3 bg-[length:300%]"
> >
Coworking streams Coworking streams
</div> </div>
@ -15,3 +16,10 @@
> >
</div> </div>
</div> </div>
<style>
#coworking-streams {
background: var(--color-hero-gradient);
-webkit-background-clip: text;
}
</style>

View file

@ -1,5 +1,5 @@
import { cn } from "../../../utils/cn"; import { cn } from "@/utils/cn";
import { AnimatePresence, motion } from "framer-motion"; import { AnimatePresence, motion } from "motion/react";
import { useState } from "react"; import { useState } from "react";
export const HoverEffect = ({ export const HoverEffect = ({
@ -87,7 +87,7 @@ export const CardTitle = ({
return ( return (
<h4 <h4
className={cn( className={cn(
"mt-4 font-bold tracking-wide text-zinc-100", "mt-4 font-bold tracking-wide text-zinc-100 text-xl",
className, className,
)} )}
> >

View file

@ -3,12 +3,14 @@ import Layout from "./Layout.astro";
import TableOfContent from "../components/blocks/TableOfContent.astro"; import TableOfContent from "../components/blocks/TableOfContent.astro";
import VerticalNav from "../components/blocks/verticalNav.astro"; import VerticalNav from "../components/blocks/verticalNav.astro";
import "../assets/styles/remark-callout-directives.css"; import "../assets/styles/remark-callout-directives.css";
import NavBar from "@/components/blocks/navBar.astro";
const { frontmatter, headings } = Astro.props; const { frontmatter, headings } = Astro.props;
--- ---
<Layout title={frontmatter.title} description={frontmatter.description}> <Layout title={frontmatter.title} description={frontmatter.description}>
<div class="mx-auto px-2 max-w-[1440px]"> <NavBar />
<div class="mx-auto px-2 max-w-[1440px] pt-[var(--header-height)]">
<div class="flex flex-col lg:grid lg:grid-cols-10 gap-5"> <div class="flex flex-col lg:grid lg:grid-cols-10 gap-5">
<!-- vertical navbar --> <!-- vertical navbar -->
<div <div
@ -16,18 +18,20 @@ const { frontmatter, headings } = Astro.props;
transition:name="vertical-navbar" transition:name="vertical-navbar"
> >
<aside <aside
class="hidden lg:translate-x-0 overflow-y-auto z-30 lg:block lg:sticky py-8 lg:max-h-[calc(100vh-var(--header-height))] lg:top-[--header-height]" class="hidden lg:translate-x-0 overflow-y-auto z-30 lg:block lg:sticky py-8 lg:max-h-[calc(100vh-var(--header-height))] lg:top-[var(--header-height)]"
> >
<VerticalNav /> <VerticalNav />
</aside> </aside>
</div> </div>
<div class="lg:col-span-8"> <div class="lg:col-span-8">
<div class="flex flex-col lg:grid lg:grid-cols-10"> <div class="flex flex-col lg:grid lg:grid-cols-10">
<div class="col-span-8 px-2 md:px-10 pb-10 pt-8"> <div
class="guide-content col-span-8 px-2 md:px-10 pb-10 pt-8"
>
<slot /> <slot />
</div> </div>
<div <div
class="hidden col-span-2 pt-8 lg:block lg:sticky lg:px-4 lg:-mx-4 lg:max-h-[calc(100vh-var(--header-height))] lg:top-[--header-height]" class="hidden col-span-2 pt-8 lg:block lg:sticky lg:px-4 lg:-mx-4 lg:max-h-[calc(100vh-var(--header-height))] lg:top-[var(--header-height)]"
> >
<!-- TOC --> <!-- TOC -->
<TableOfContent <TableOfContent
@ -39,10 +43,108 @@ const { frontmatter, headings } = Astro.props;
</div> </div>
</div> </div>
</div> </div>
<script is:inline>
// make all <a> attributes have target="_blank" except for Table of Contents
document.querySelectorAll("a:not(.no-target-blank)").forEach((el) => {
el.setAttribute("target", "_blank");
});
</script>
</Layout> </Layout>
<script is:inline>
// make all <a> attributes have target="_blank" except for Table of Contents
document.querySelectorAll("a:not(.no-target-blank)").forEach((el) => {
el.setAttribute("target", "_blank");
});
</script>
<style is:inline>
.guide-content blockquote {
margin: 1rem 0;
border-left: 4px solid #718096;
padding-left: 1rem;
}
.guide-content a {
display: inline-block;
color: #4299e1;
text-decoration: none;
}
.guide-content a:hover {
text-decoration: underline;
}
.guide-content h1 {
margin-bottom: 0.5rem;
font-size: 2.75rem;
font-weight: bold;
scroll-margin-top: 3.7rem;
}
.guide-content h2 {
margin-bottom: 0.5rem;
margin-top: 1.5rem;
font-size: 1.875rem;
font-weight: bold;
scroll-margin-top: 3.7rem;
}
.guide-content h3 {
margin-bottom: 0.5rem;
margin-top: 1.25rem;
font-size: 1.5rem;
font-weight: bold;
scroll-margin-top: 3.7rem;
}
.guide-content h4 {
margin-bottom: 0.5rem;
margin-top: 1.25rem;
font-size: 1.25rem;
font-weight: bold;
scroll-margin-top: 3.7rem;
}
.guide-content p {
margin-bottom: 0.5rem;
margin-top: 0.5rem;
font-family: system-ui;
font-size: 1rem;
line-height: 1.75rem;
}
.guide-content hr {
margin: 2.5rem 0;
/* border-color: #add19c; */
}
.guide-content ul,
.guide-content ol {
list-style-position: outside;
line-height: 1.75rem;
}
.guide-content ul {
list-style-type: disc;
}
.guide-content ul ul,
.guide-content ol ul {
margin-bottom: 0.5rem;
margin-left: 1.25rem;
list-style-type: circle;
}
.guide-content ul li,
.guide-content ol li {
margin-bottom: 0.25rem;
margin-left: 1.25rem;
}
.guide-content ol {
margin-left: 1.25rem;
list-style-type: decimal;
}
.guide-content code {
border-radius: 0.375rem;
background-color: #323232;
padding: 0.5rem;
font-family: monospace;
font-size: 0.875rem;
}
</style>

View file

@ -1,6 +1,6 @@
--- ---
import NavBar from "../components/blocks/navBar.astro"; import { ClientRouter } from "astro:transitions";
import { ViewTransitions } from "astro:transitions"; import "@/styles/global.css";
export interface Props { export interface Props {
title: string; title: string;
@ -50,13 +50,12 @@ const { title, description } = Astro.props;
<link href="/pagefind/pagefind-ui.css" rel="stylesheet" /> <link href="/pagefind/pagefind-ui.css" rel="stylesheet" />
<script src="/pagefind/pagefind-ui.js" is:inline></script> <script src="/pagefind/pagefind-ui.js" is:inline></script>
<script is:inline src="/_vercel/insights/script.js"></script> <script is:inline src="/_vercel/insights/script.js"></script>
<ViewTransitions /> <ClientRouter />
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
<title>{title}</title> <title>{title}</title>
</head> </head>
<body> <body>
<div class="pt-[var(--header-height)] bg-none"> <div class="bg-none">
<NavBar />
<slot /> <slot />
</div> </div>
<script> <script>
@ -73,12 +72,6 @@ const { title, description } = Astro.props;
--header-height: 3.5rem; --header-height: 3.5rem;
} }
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html { html {
font-family: system-ui, sans-serif; font-family: system-ui, sans-serif;
background-color: #171717; background-color: #171717;

View file

@ -2,13 +2,17 @@
import Layout from "../layouts/Layout.astro"; import Layout from "../layouts/Layout.astro";
import Hero from "../components/blocks/Hero.astro"; import Hero from "../components/blocks/Hero.astro";
import BlurBackground from "../components/ui/BlurBackground.astro"; import BlurBackground from "../components/ui/BlurBackground.astro";
import NavBar from "@/components/blocks/navBar.astro";
--- ---
<Layout <Layout
title="Coworking Stream Guide" title="Coworking Stream Guide"
description="A guide for new and existing coworking streamers!" description="A guide for new and existing coworking streamers!"
> >
<div class="relative overflow-hidden h-fit min-h-screen w-full"> <NavBar />
<div
class="relative overflow-hidden h-fit min-h-screen w-full pt-[var(--header-height)]"
>
<BlurBackground /> <BlurBackground />
<div class="flex justify-center items-start pb-10"> <div class="flex justify-center items-start pb-10">
<Hero /> <Hero />

34
src/styles/global.css Normal file
View file

@ -0,0 +1,34 @@
@import "tailwindcss";
@theme {
--color-primary: #fafafa;
--color-secondary: #171717;
--color-primary-green: #8DECB4;
--color-primary-blue: #3f84d8;
--color-light-blue: #b3c6f9;
--header-height: 3.5rem;
--color-hero-gradient: linear-gradient(to right, #3F84D8, aquamarine);
--animate-gradient: gradient 15s ease infinite;
@keyframes gradient {
"0%": {
"background-position": "0% 50%",
}
"50%": {
"background-position": "100% 50%",
}
"100%": {
"background-position": "0% 50%",
}
}
@keyframes fadeIn {
from: {
opacity: "0",
}
to: {
opacity: "1",
}
}
}