Compare commits
35 Commits
4b08604f0c
...
2.25.0
| Author | SHA1 | Date | |
|---|---|---|---|
| e91ffd8686 | |||
| 00a86b1206 | |||
| 7327795d39 | |||
| ae57c60935 | |||
| 245e0f0624 | |||
|
082afca9da
|
|||
| 16e14f63ef | |||
| ce9c9c3857 | |||
| 345ab93e0c | |||
| 07c7edeb0f | |||
| d3b2b40ccb | |||
| 091af909d4 | |||
| 8a7b6b97b7 | |||
| fe3899242a | |||
| e6d4e34a0a | |||
| 5877086cc3 | |||
| 6cfc1f62a7 | |||
|
0b452b919a
|
|||
| 50f050c0b6 | |||
| 8b07837c0d | |||
| 6fca640fd8 | |||
| 89fd0eb7ce | |||
| 95ea235f9f | |||
| fe6604a5d9 | |||
| 2c2077053b | |||
| e7c660c142 | |||
| f4676d151f | |||
| ed0a691442 | |||
| 2aa17cd9c7 | |||
|
48991d411d
|
|||
|
724c85332f
|
|||
| bb4b9600e8 | |||
| 42c24882ff | |||
|
daef38d80d
|
|||
|
e4de55fab3
|
@@ -26,7 +26,18 @@ jobs:
|
|||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pnpm install
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Cache Astro Build Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules/.cache
|
||||||
|
.astro/cache
|
||||||
|
key: ${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
|
${{ runner.os }}-astro-cache-
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
@@ -62,7 +73,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
with:
|
with:
|
||||||
driver: kubernetes
|
driver: kubernetes
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -101,7 +112,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build and Push Image
|
- name: Build and Push Image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
@@ -113,6 +124,8 @@ jobs:
|
|||||||
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
||||||
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: ntfy Success
|
- name: ntfy Success
|
||||||
uses: niniyas/ntfy-action@master
|
uses: niniyas/ntfy-action@master
|
||||||
|
|||||||
@@ -26,7 +26,18 @@ jobs:
|
|||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pnpm install
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Cache Astro Build Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules/.cache
|
||||||
|
.astro/cache
|
||||||
|
key: ${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
|
${{ runner.os }}-astro-cache-
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
@@ -62,7 +73,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
with:
|
with:
|
||||||
driver: kubernetes
|
driver: kubernetes
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
@@ -101,7 +112,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build and Push Image
|
- name: Build and Push Image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
@@ -113,6 +124,8 @@ jobs:
|
|||||||
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
||||||
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: ntfy Success
|
- name: ntfy Success
|
||||||
uses: niniyas/ntfy-action@master
|
uses: niniyas/ntfy-action@master
|
||||||
|
|||||||
@@ -28,7 +28,18 @@ jobs:
|
|||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pnpm install
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Cache Astro Build Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules/.cache
|
||||||
|
.astro/cache
|
||||||
|
key: ${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
|
${{ runner.os }}-astro-cache-
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ WORKDIR /app
|
|||||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||||
COPY --from=build /app/dist /app/dist
|
COPY --from=build /app/dist /app/dist
|
||||||
|
|
||||||
LABEL version="2.19.0"
|
LABEL version="2.25.0"
|
||||||
LABEL description="Astro based personal website"
|
LABEL description="Astro based personal website"
|
||||||
|
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "site-profile",
|
"name": "site-profile",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.19.0",
|
"version": "2.25.0",
|
||||||
"homepage": "https://www.alexlebens.dev",
|
"homepage": "https://www.alexlebens.dev",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitea.alexlebens.dev/alexlebens/site-profile/issues",
|
"url": "https://gitea.alexlebens.dev/alexlebens/site-profile/issues",
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
"@astrojs/react": "^4.4.2",
|
"@astrojs/react": "^4.4.2",
|
||||||
"@astrojs/rss": "^4.0.15",
|
"@astrojs/rss": "^4.0.15",
|
||||||
"@astrojs/sitemap": "^3.7.0",
|
"@astrojs/sitemap": "^3.7.0",
|
||||||
"@directus/sdk": "^21.1.0",
|
"@directus/sdk": "^21.2.0",
|
||||||
"@giscus/react": "^3.1.0",
|
"@giscus/react": "^3.1.0",
|
||||||
"@iconify-json/mdi": "^1.2.3",
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@iconify-json/pajamas": "^1.2.15",
|
"@iconify-json/pajamas": "^1.2.15",
|
||||||
@@ -46,9 +46,10 @@
|
|||||||
"@types/unist": "^3.0.3",
|
"@types/unist": "^3.0.3",
|
||||||
"astro": "^5.18.0",
|
"astro": "^5.18.0",
|
||||||
"astro-icon": "^1.1.5",
|
"astro-icon": "^1.1.5",
|
||||||
"marked": "^17.0.3",
|
"marked": "^17.0.4",
|
||||||
"marked-shiki": "^1.2.1",
|
"marked-shiki": "^1.2.1",
|
||||||
"mdast-util-to-string": "^4.0.0",
|
"mdast-util-to-string": "^4.0.0",
|
||||||
|
"photoswipe": "^5.4.4",
|
||||||
"preline": "^4.1.2",
|
"preline": "^4.1.2",
|
||||||
"react": "^19.2.4",
|
"react": "^19.2.4",
|
||||||
"react-dom": "^19.2.4",
|
"react-dom": "^19.2.4",
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
"@eslint-react/eslint-plugin": "^2.13.0",
|
"@eslint-react/eslint-plugin": "^2.13.0",
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"eslint": "^10.0.2",
|
"eslint": "^10.0.3",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-astro": "^1.6.0",
|
"eslint-plugin-astro": "^1.6.0",
|
||||||
"eslint-plugin-format": "^2.0.1",
|
"eslint-plugin-format": "^2.0.1",
|
||||||
|
|||||||
566
pnpm-lock.yaml
generated
566
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
BIN
public/i.jpg
BIN
public/i.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 381 KiB |
@@ -12,7 +12,7 @@ const currentPath = pathname.slice(1);
|
|||||||
class="fixed flex flex-wrap md:flex-nowrap md:justify-start inset-x-0 top-0 w-full z-50"
|
class="fixed flex flex-wrap md:flex-nowrap md:justify-start inset-x-0 top-0 w-full z-50"
|
||||||
>
|
>
|
||||||
<nav
|
<nav
|
||||||
class="nav-base relative md:flex md:items-center md:justify-between rounded-[36px] w-full px-4 mx-2 py-3 mt-4"
|
class="nav-base relative md:flex md:items-center md:justify-between rounded-[36px] transition-all duration-300 w-full px-4 py-3 mx-2 md:mx-8 mt-4"
|
||||||
aria-label="Global"
|
aria-label="Global"
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-between ml-0">
|
<div class="flex items-center justify-between ml-0">
|
||||||
|
|||||||
@@ -2,28 +2,30 @@
|
|||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
|
import { formatDate } from '@support/time';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
subTitle: string;
|
subTitle: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
pubDate: Date,
|
||||||
img: string;
|
img: string;
|
||||||
imgAlt: string;
|
imgAlt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, subTitle, url, img, imgAlt } = Astro.props;
|
const { title, subTitle, url, pubDate, img, imgAlt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto">
|
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
||||||
<a
|
<a
|
||||||
class="md:card-base-hidden group items-center md:grid md:grid-cols-2 lg:grid lg:grid-cols-2 gap-8 xl:gap-16 max-w-340 2xl:max-w-full md:px-8 md:py-8"
|
class="md:card-base-hidden group items-center md:grid md:grid-cols-2 lg:grid lg:grid-cols-2 gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
||||||
href={url}
|
href={url}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-2xl rounded-b-none md:rounded-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
||||||
src={getDirectusImageURL(img)}
|
src={getDirectusImageURL(img)}
|
||||||
alt={imgAlt}
|
alt={imgAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
@@ -40,17 +42,21 @@ const { title, subTitle, url, img, imgAlt } = Astro.props;
|
|||||||
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
{subTitle}
|
{subTitle}
|
||||||
</p>
|
</p>
|
||||||
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
<div class="flex items-center justify-between w-full">
|
||||||
<div class="button-text-title flex relative items-center text-center">
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
<span class="mr-2">
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
Read More
|
<span class="mr-2">
|
||||||
</span>
|
Read More
|
||||||
<Icon
|
</span>
|
||||||
name="mdi:keyboard-arrow-right"
|
<Icon
|
||||||
class="button-hover-arrow"
|
name="mdi:keyboard-arrow-right"
|
||||||
/>
|
class="button-hover-arrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="card-text-description text-sm ml-auto">
|
||||||
|
{formatDate(pubDate)}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,25 +2,26 @@
|
|||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
|
import { formatDate } from '@support/time';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
subTitle: string;
|
subTitle: string;
|
||||||
url: string;
|
url: string;
|
||||||
single?: boolean;
|
pubDate: Date;
|
||||||
imgOne: any;
|
imgOne: string;
|
||||||
imgOneAlt: any;
|
imgOneAlt: string;
|
||||||
imgTwo?: any;
|
imgTwo?: string;
|
||||||
imgTwoAlt?: any;
|
imgTwoAlt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, subTitle, url, single, imgOne, imgOneAlt, imgTwo, imgTwoAlt } = Astro.props;
|
const { title, subTitle, url, pubDate, imgOne, imgOneAlt, imgTwo, imgTwoAlt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal flex flex-col px-5 py-10 mx-auto">
|
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
||||||
<a
|
<a
|
||||||
class="md:card-base-hidden group flex flex-col-reverse md:items-center md:grid md:grid-cols-2 lg:grid lg:grid-cols-2 md:gap-8 xl:gap-16 max-w-340 2xl:max-w-full md:px-8 md:py-8"
|
class="md:card-base-hidden group flex flex-col-reverse md:grid md:items-center md:grid-cols-2 lg:grid lg:grid-cols-2 md:gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
||||||
href={url}
|
href={url}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
@@ -31,25 +32,30 @@ const { title, subTitle, url, single, imgOne, imgOneAlt, imgTwo, imgTwoAlt } = A
|
|||||||
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
{subTitle}
|
{subTitle}
|
||||||
</p>
|
</p>
|
||||||
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
<div class="flex items-center justify-between w-full">
|
||||||
<div class="button-text-title flex relative items-center text-center">
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
<span class="mr-2">
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
Read More
|
<span class="mr-2">
|
||||||
</span>
|
Read More
|
||||||
<Icon
|
</span>
|
||||||
name="mdi:keyboard-arrow-right"
|
<Icon
|
||||||
class="button-hover-arrow"
|
name="mdi:keyboard-arrow-right"
|
||||||
/>
|
class="button-hover-arrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="card-text-description text-sm ml-auto">
|
||||||
|
{formatDate(pubDate)}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{single ? (
|
{!imgTwo ? (
|
||||||
<div>
|
<div>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-2xl rounded-b-none md:rounded-2xl w-full"
|
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
||||||
src={getDirectusImageURL(imgOne)}
|
src={getDirectusImageURL(imgOne)}
|
||||||
alt={imgOneAlt}
|
alt={imgOneAlt}
|
||||||
format="webp"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
width="850"
|
width="850"
|
||||||
height="420"
|
height="420"
|
||||||
@@ -57,30 +63,42 @@ const { title, subTitle, url, single, imgOne, imgOneAlt, imgTwo, imgTwoAlt } = A
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<>
|
||||||
<Image
|
<div class="md:hidden">
|
||||||
class="rounded-xl w-full"
|
<Image
|
||||||
src={getDirectusImageURL(imgOne)}
|
class="rounded-2xl rounded-b-none shadow-2xl w-full h-full sm:max-h-80 object-cover"
|
||||||
alt={imgOneAlt}
|
src={getDirectusImageURL(imgOne)}
|
||||||
draggable="false"
|
alt={imgOneAlt}
|
||||||
format="webp"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
width="400"
|
width="850"
|
||||||
height="230"
|
height="420"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
<Image
|
</div>
|
||||||
class="rounded-xl w-full mt-4 lg:mt-10"
|
<div class="hidden md:flex md:items-start">
|
||||||
src={getDirectusImageURL(imgTwo)}
|
<Image
|
||||||
alt={imgTwoAlt}
|
class="rounded-xl z-10 shadow-2xl w-3/5 h-full object-cover"
|
||||||
draggable="false"
|
src={getDirectusImageURL(imgOne)}
|
||||||
format="webp"
|
alt={imgOneAlt}
|
||||||
loading="lazy"
|
draggable="false"
|
||||||
width="400"
|
loading="lazy"
|
||||||
height="230"
|
width="600"
|
||||||
inferSize={true}
|
height="310"
|
||||||
/>
|
inferSize={true}
|
||||||
</div>
|
/>
|
||||||
|
<Image
|
||||||
|
class="rounded-xl shadow-2xl w-3/5 h-full -ml-16 mt-12 object-cover"
|
||||||
|
src={getDirectusImageURL(imgTwo)}
|
||||||
|
alt={imgTwoAlt}
|
||||||
|
draggable="false"
|
||||||
|
loading="lazy"
|
||||||
|
width="600"
|
||||||
|
height="310"
|
||||||
|
inferSize={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
77
src/components/cards/LargeCategoryCard.astro
Normal file
77
src/components/cards/LargeCategoryCard.astro
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
---
|
||||||
|
import Logo from '@components/images/Logo.astro';
|
||||||
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
url: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
logoLight: string;
|
||||||
|
logoDark?: string;
|
||||||
|
count: number;
|
||||||
|
publishDate: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { url, title, description, logoLight, logoDark, count, publishDate } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class="smooth-reveal flex flex-col mx-auto w-full">
|
||||||
|
<a
|
||||||
|
class="card-base flex flex-col h-full min-h-55"
|
||||||
|
href={url}
|
||||||
|
data-astro-prefetch
|
||||||
|
>
|
||||||
|
<div class="relative grow overflow-hidden">
|
||||||
|
<div class="absolute inset-1 flex flex-col p-3 md:p-4 lg:p-5">
|
||||||
|
<div class="flex flex-row items-center mb-4">
|
||||||
|
<div class="card-hover-icon-scale shrink-0 mr-3">
|
||||||
|
<Logo
|
||||||
|
srcLight={getDirectusImageURL(logoLight)}
|
||||||
|
srcDark={getDirectusImageURL(logoDark!)}
|
||||||
|
alt={`Logo of ${title}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<h3 class="card-text-title-major card-hover-text-title whitespace-nowrap">
|
||||||
|
{title}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="card-text-description mb-4">
|
||||||
|
{description}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-text-description flex items-center justify-between text-xs mt-auto pt-1 md:pt-2">
|
||||||
|
<span class="inline-flex items-center">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="mr-1"
|
||||||
|
>
|
||||||
|
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"></path>
|
||||||
|
</svg>
|
||||||
|
{count}
|
||||||
|
</span>
|
||||||
|
<span class="inline-flex items-center">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="mr-1"
|
||||||
|
>
|
||||||
|
<circle cx="12" cy="12" r="10"></circle>
|
||||||
|
<polyline points="12 6 12 12 16 14"></polyline>
|
||||||
|
</svg>
|
||||||
|
{publishDate}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
59
src/components/cards/LargeInvisibleCard.astro
Normal file
59
src/components/cards/LargeInvisibleCard.astro
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
title: string;
|
||||||
|
subTitle: string;
|
||||||
|
url: string;
|
||||||
|
img?: string;
|
||||||
|
imgAlt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { title, subTitle, url, img, imgAlt } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class="smooth-reveal flex flex-col mx-auto w-full">
|
||||||
|
<a
|
||||||
|
class="md:card-base-hidden group items-center md:grid md:grid-cols-2 lg:grid lg:grid-cols-2 gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
||||||
|
href={url}
|
||||||
|
data-astro-prefetch
|
||||||
|
>
|
||||||
|
{img && (
|
||||||
|
<div>
|
||||||
|
<Image
|
||||||
|
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
||||||
|
src={getDirectusImageURL(img)}
|
||||||
|
alt={imgAlt}
|
||||||
|
draggable="false"
|
||||||
|
loading="lazy"
|
||||||
|
width="850"
|
||||||
|
height="420"
|
||||||
|
inferSize={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div class="bg-background-card md:bg-transparent group-hover:bg-neutral-100 md:group-hover:bg-transparent dark:group-hover:bg-neutral-800/90 md:dark:group-hover:bg-transparent rounded-b-2xl transition-all duration-300 p-6">
|
||||||
|
<h2 class="card-text-header mb-2">
|
||||||
|
{title}
|
||||||
|
</h2>
|
||||||
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
|
{subTitle}
|
||||||
|
</p>
|
||||||
|
<div class="flex items-center justify-between w-full">
|
||||||
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
|
<span class="mr-2">
|
||||||
|
Read More
|
||||||
|
</span>
|
||||||
|
<Icon
|
||||||
|
name="mdi:keyboard-arrow-right"
|
||||||
|
class="button-hover-arrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
31
src/components/sections/AllCategoriesSection.astro
Normal file
31
src/components/sections/AllCategoriesSection.astro
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
import { readItems, readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
import LargeCategoryCard from '@components/cards/LargeCategoryCard.astro';
|
||||||
|
import directus from '@lib/directus';
|
||||||
|
import { timeago } from '@support/time';
|
||||||
|
|
||||||
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
|
||||||
|
const posts = await directus.request(
|
||||||
|
readItems('posts', {
|
||||||
|
filter: { published: { _eq: true } },
|
||||||
|
fields: ['*'],
|
||||||
|
sort: ['-published_date'],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
---
|
||||||
|
|
||||||
|
<section class:list={['mx-auto px-4 py-10 sm:px-6 lg:px-8 lg:py-14 lg:pt-10 2xl:max-w-full', Astro.props.className]}>
|
||||||
|
<div class="grid grid-cols-1">
|
||||||
|
<LargeCategoryCard
|
||||||
|
title="All Categories"
|
||||||
|
description="Here you can forgoe the organization and just look at everything I have posted"
|
||||||
|
url="/all"
|
||||||
|
logoLight={global.all_logoLight}
|
||||||
|
logoDark={global.all_logoDark}
|
||||||
|
count={posts.length}
|
||||||
|
publishDate={timeago(posts[0]?.published_date)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
20
src/components/sections/AllPostsSection.astro
Normal file
20
src/components/sections/AllPostsSection.astro
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
import LargeInvisibleCard from '@components/cards/LargeInvisibleCard.astro';
|
||||||
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
---
|
||||||
|
|
||||||
|
<section class:list={['mx-auto px-4 py-10 sm:px-6 lg:px-8 lg:py-14 lg:pt-10 2xl:max-w-full', Astro.props.className]}>
|
||||||
|
<div class="grid grid-cols-1">
|
||||||
|
<LargeInvisibleCard
|
||||||
|
title="All Posts"
|
||||||
|
subTitle="Browse all articles from every category"
|
||||||
|
url="/all"
|
||||||
|
img={global.all_image}
|
||||||
|
imgAlt={global.all_image_alt}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { readItems } from '@directus/sdk';
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
import type { Post, Category } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import CategoryCard from '@components/cards/CategoryCard.astro';
|
import CategoryCard from '@components/cards/CategoryCard.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
@@ -10,7 +10,7 @@ import { timeago } from '@support/time';
|
|||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*'],
|
fields: ['*', 'category.slug'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -31,13 +31,16 @@ const layoutPattern = [
|
|||||||
const postMap: Map<string, Post[]> = posts
|
const postMap: Map<string, Post[]> = posts
|
||||||
.sort((a: Post, b: Post) => b.published_date.valueOf() - a.published_date.valueOf())
|
.sort((a: Post, b: Post) => b.published_date.valueOf() - a.published_date.valueOf())
|
||||||
.reduce((acc, obj) => {
|
.reduce((acc, obj) => {
|
||||||
let posts = acc.get(obj.category);
|
const categorySlug = obj.category?.slug;
|
||||||
|
if (!categorySlug) return acc;
|
||||||
|
|
||||||
|
let posts = acc.get(categorySlug);
|
||||||
if (!posts) {
|
if (!posts) {
|
||||||
posts = [];
|
posts = [];
|
||||||
}
|
}
|
||||||
posts.push(obj);
|
posts.push(obj);
|
||||||
|
|
||||||
acc.set(obj.category, posts);
|
acc.set(categorySlug, posts);
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, new Map<string, Post[]>());
|
}, new Map<string, Post[]>());
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ const { posts, title, subTitle } = Astro.props;
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
<div class="columns-1 sm:columns-2 lg:columns-3 gap-6">
|
||||||
{posts.map((b) => <BlogCard post={b} />)}
|
{posts.map((b) => (
|
||||||
|
<div class="break-inside-avoid mb-6">
|
||||||
|
<BlogCard post={b} />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -11,12 +11,13 @@ interface Props {
|
|||||||
const { posts } = Astro.props;
|
const { posts } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="smooth-reveal flex flex-col gap-4">
|
<section class="smooth-reveal flex flex-col gap-4 md:mb-20">
|
||||||
{posts.map((post, index) => index % 2 === 0 ? (
|
{posts.map((post, index) => index % 2 === 0 ? (
|
||||||
<LargeBlogLeftCard
|
<LargeBlogLeftCard
|
||||||
title={post.title}
|
title={post.title}
|
||||||
subTitle={post.description}
|
subTitle={post.description}
|
||||||
url={`/blog/${post.slug}`}
|
url={`/blog/${post.slug}`}
|
||||||
|
pubDate={post.published_date}
|
||||||
img={post.image}
|
img={post.image}
|
||||||
imgAlt={post.image_alt}
|
imgAlt={post.image_alt}
|
||||||
/>
|
/>
|
||||||
@@ -25,7 +26,7 @@ const { posts } = Astro.props;
|
|||||||
title={post.title}
|
title={post.title}
|
||||||
subTitle={post.description}
|
subTitle={post.description}
|
||||||
url={`/blog/${post.slug}`}
|
url={`/blog/${post.slug}`}
|
||||||
single={!post.image_second}
|
pubDate={post.published_date}
|
||||||
imgOne={post.image}
|
imgOne={post.image}
|
||||||
imgOneAlt={post.image_alt}
|
imgOneAlt={post.image_alt}
|
||||||
imgTwo={post?.image_second}
|
imgTwo={post?.image_second}
|
||||||
|
|||||||
@@ -68,67 +68,66 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
/>
|
/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="bg-background selection:bg-yellow-400 m-0 p-0 overflow-x-hidden">
|
<body class="bg-background selection:bg-yellow-400 m-0 p-0 overflow-hidden">
|
||||||
|
|
||||||
<!-- Sliding backgrounds -->
|
<!-- Sliding backgrounds -->
|
||||||
<div class="bg"/>
|
<div class="bg"/>
|
||||||
<div class="bg bg2"/>
|
<div class="bg bg2"/>
|
||||||
<div class="bg bg3"/>
|
<div class="bg bg3"/>
|
||||||
|
|
||||||
<!-- Layout -->
|
<!-- Fixed header -->
|
||||||
<div class="grow w-full max-w-(--breakpoint-2xl) px-4 sm:px-6 lg:px-8 py-20 mx-auto">
|
<Header />
|
||||||
|
|
||||||
<Header />
|
<!-- Main body -->
|
||||||
|
<div id="reset-scroll" class="mask-container w-screen h-screen overflow-y-auto overflow-x-hidden">
|
||||||
|
<main>
|
||||||
|
|
||||||
<main class="has-js scroll-fade-container min-h-screen">
|
<!-- Content -->
|
||||||
<slot />
|
<div class="grow w-full max-w-(--breakpoint-2xl) px-4 sm:px-6 lg:px-8 py-20 mx-auto">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<Footer />
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Footer />
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('astro:page-load', () => {
|
const resetScroll = () => {
|
||||||
const onScroll = () => {
|
const scrollContainer = document.getElementById('reset-scroll');
|
||||||
document.documentElement.style.setProperty('--scroll-offset', `${window.scrollY}px`);
|
if (scrollContainer) {
|
||||||
document.documentElement.classList.add('has-js');
|
scrollContainer.scrollTop = 0;
|
||||||
};
|
}
|
||||||
|
};
|
||||||
window.removeEventListener('scroll', onScroll);
|
resetScroll();
|
||||||
window.addEventListener('scroll', onScroll, { passive: true });
|
document.addEventListener('astro:after-swap', resetScroll);
|
||||||
|
|
||||||
onScroll();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Fade away content below header when scrolling */
|
/* Fade away content below header when scrolling */
|
||||||
.has-js .scroll-fade-container {
|
.mask-container {
|
||||||
-webkit-mask-image: linear-gradient(
|
-webkit-mask-image: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
transparent 0px,
|
transparent 0px,
|
||||||
transparent 16px,
|
transparent 90px,
|
||||||
black 80px,
|
black 140px,
|
||||||
black 100%
|
black 100%
|
||||||
);
|
);
|
||||||
|
|
||||||
mask-image: linear-gradient(
|
mask-image: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
transparent 0px,
|
transparent 0px,
|
||||||
transparent 16px,
|
transparent 90px,
|
||||||
black 60px,
|
black 140px,
|
||||||
black 100%
|
black 100%
|
||||||
);
|
);
|
||||||
|
|
||||||
-webkit-mask-size: 100vw 100vh;
|
-webkit-mask-size: 100vw 100vh;
|
||||||
-webkit-mask-repeat: no-repeat;
|
-webkit-mask-repeat: no-repeat;
|
||||||
|
|
||||||
-webkit-mask-position-y: var(--scroll-offset);
|
|
||||||
mask-position-y: var(--scroll-offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Background that creates the "glimmer" effect */
|
/* Background that creates the "glimmer" effect */
|
||||||
@@ -149,9 +148,9 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(.dark) .bg {
|
:global(.dark) .bg {
|
||||||
--bg-primary: #332f2e;
|
--bg-primary: #3b3836;
|
||||||
--bg-secondary: #44403c;
|
--bg-secondary: #332f2e;
|
||||||
--bg-tertiary: #57534e;
|
--bg-tertiary: #44403c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg2 {
|
.bg2 {
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ export type Global = {
|
|||||||
portrait_alt: string;
|
portrait_alt: string;
|
||||||
home_image: string;
|
home_image: string;
|
||||||
home_image_alt: string;
|
home_image_alt: string;
|
||||||
|
all_image: string;
|
||||||
|
all_image_alt: string;
|
||||||
|
all_logoLight: string;
|
||||||
|
all_logoDark: string;
|
||||||
blog_image: string;
|
blog_image: string;
|
||||||
blog_image_alt: string;
|
blog_image_alt: string;
|
||||||
categories_image: string;
|
categories_image: string;
|
||||||
@@ -37,7 +41,7 @@ export type Post = {
|
|||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
category: string;
|
category: Category;
|
||||||
selected: boolean;
|
selected: boolean;
|
||||||
published: boolean;
|
published: boolean;
|
||||||
content: string;
|
content: string;
|
||||||
|
|||||||
109
src/pages/all.astro
Normal file
109
src/pages/all.astro
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
---
|
||||||
|
import { readItems, readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
import HeaderSection from '@components/sections/HeaderSection.astro';
|
||||||
|
import BlogCard from '@components/cards/BlogCard.astro';
|
||||||
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
const posts = await directus.request(
|
||||||
|
readItems('posts', {
|
||||||
|
filter: { published: { _eq: true } },
|
||||||
|
fields: ['*'],
|
||||||
|
sort: ['-published_date'],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
---
|
||||||
|
|
||||||
|
<BaseLayout
|
||||||
|
title="All Posts"
|
||||||
|
description="Browse all articles from every category."
|
||||||
|
structuredData={{
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'WebPage',
|
||||||
|
inLanguage: 'en-US',
|
||||||
|
'@id': Astro.url.href,
|
||||||
|
url: Astro.url.href,
|
||||||
|
name: `All Posts | ${global.name}`,
|
||||||
|
description: "Browse all articles from every category.",
|
||||||
|
isPartOf: {
|
||||||
|
url: `${global.site_url}`,
|
||||||
|
name: global.name,
|
||||||
|
description: global.about,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
|
||||||
|
<HeaderSection
|
||||||
|
title="All Posts"
|
||||||
|
subTitle="Browse all articles from every category."
|
||||||
|
btnExists
|
||||||
|
btnTitle="To Categories"
|
||||||
|
btnURL="/categories"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<section class="max-w-340 2xl:max-w-full mb-10 px-4 sm:px-6 lg:px-8 py-8 mx-auto mt-10">
|
||||||
|
<div class="columns-1 sm:columns-2 lg:columns-3 gap-6">
|
||||||
|
{posts.map((b) =>
|
||||||
|
<div class="break-inside-avoid mb-6">
|
||||||
|
<BlogCard post={b} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</BaseLayout>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Add smooth reveal animations for content after loading
|
||||||
|
document.addEventListener('astro:page-load', () => {
|
||||||
|
const animateContent = () => {
|
||||||
|
// Animate group 1
|
||||||
|
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
||||||
|
smoothReveal.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
50 + index * 100
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate group 2
|
||||||
|
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
||||||
|
smoothReveal2.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
200 + index * 150
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate topic cards with staggered delay
|
||||||
|
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
||||||
|
smoothRevealCards.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
500 + index * 100
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate with just fade in with staggered delay
|
||||||
|
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
||||||
|
smoothRevealFade.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal-fade');
|
||||||
|
},
|
||||||
|
100 + index * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
animateContent();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -6,6 +6,7 @@ import { marked } from 'marked';
|
|||||||
import markedShiki from 'marked-shiki';
|
import markedShiki from 'marked-shiki';
|
||||||
import { createHighlighter } from 'shiki';
|
import { createHighlighter } from 'shiki';
|
||||||
import { readItems, readSingleton } from '@directus/sdk';
|
import { readItems, readSingleton } from '@directus/sdk';
|
||||||
|
import 'photoswipe/style.css';
|
||||||
|
|
||||||
import SocialShareButton from '@components/buttons/SocialShareButton.astro';
|
import SocialShareButton from '@components/buttons/SocialShareButton.astro';
|
||||||
import Logo from '@components/images/Logo.astro';
|
import Logo from '@components/images/Logo.astro';
|
||||||
@@ -17,7 +18,9 @@ import { getDirectusImageURL } from '@/support/url';
|
|||||||
const post = Astro.props;
|
const post = Astro.props;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await directus.request(readItems('posts'));
|
const posts = await directus.request(readItems('posts', {
|
||||||
|
fields: ['*', 'category.*'],
|
||||||
|
}));
|
||||||
return posts.map((post) => ({
|
return posts.map((post) => ({
|
||||||
params: { slug: post.slug },
|
params: { slug: post.slug },
|
||||||
props: post,
|
props: post,
|
||||||
@@ -25,12 +28,7 @@ export async function getStaticPaths() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
const [category] = post.category ? await directus.request(
|
const category = post.category;
|
||||||
readItems('categories', {
|
|
||||||
filter: { slug: { _eq: post.category },},
|
|
||||||
limit: 1,
|
|
||||||
}))
|
|
||||||
: [];
|
|
||||||
|
|
||||||
const readingTime = getReadingTime(post.content || '');
|
const readingTime = getReadingTime(post.content || '');
|
||||||
|
|
||||||
@@ -182,6 +180,40 @@ const content = marked.parse(post.content || '');
|
|||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import PhotoSwipeLightbox from 'photoswipe/lightbox';
|
||||||
|
const prose = document.querySelector('.prose');
|
||||||
|
if (prose) {
|
||||||
|
const images = prose.querySelectorAll('img');
|
||||||
|
images.forEach((img) => {
|
||||||
|
if (img.closest('a')) return;
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = img.src;
|
||||||
|
link.dataset.pswpSrc = img.src;
|
||||||
|
link.dataset.pswpWidth = img.naturalWidth.toString();
|
||||||
|
link.dataset.pswpHeight = img.naturalHeight.toString();
|
||||||
|
link.target = '_blank';
|
||||||
|
link.classList.add('pswp-link');
|
||||||
|
|
||||||
|
img.parentNode?.insertBefore(link, img);
|
||||||
|
link.appendChild(img);
|
||||||
|
|
||||||
|
if (!img.complete) {
|
||||||
|
img.onload = () => {
|
||||||
|
link.dataset.pswpWidth = img.naturalWidth.toString();
|
||||||
|
link.dataset.pswpHeight = img.naturalHeight.toString();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const lightbox = new PhotoSwipeLightbox({
|
||||||
|
gallery: prose,
|
||||||
|
children: 'a.pswp-link',
|
||||||
|
pswpModule: () => import('photoswipe'),
|
||||||
|
});
|
||||||
|
|
||||||
|
lightbox.init();
|
||||||
|
}
|
||||||
|
|
||||||
// Add smooth reveal animations for content after loading
|
// Add smooth reveal animations for content after loading
|
||||||
document.addEventListener('astro:page-load', () => {
|
document.addEventListener('astro:page-load', () => {
|
||||||
const animateContent = () => {
|
const animateContent = () => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { Post } from '@lib/directusTypes';
|
|||||||
import HeroSection from '@components/sections/HeroSection.astro';
|
import HeroSection from '@components/sections/HeroSection.astro';
|
||||||
import SelectedPostsSection from '@components/sections/SelectedPostsSection.astro';
|
import SelectedPostsSection from '@components/sections/SelectedPostsSection.astro';
|
||||||
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
||||||
|
import AllPostsSection from '@components/sections/AllPostsSection.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ const posts = await directus.request(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectedPosts: Post[] = posts.filter((p) => p.selected).slice(0, 3);
|
const selectedPosts: Post[] = posts.filter((p) => p.selected).slice(0, 4);
|
||||||
const recentPosts: Post[] = posts.filter(
|
const recentPosts: Post[] = posts.filter(
|
||||||
(p) => !selectedPosts.some((selected) => selected.slug === p.slug)
|
(p) => !selectedPosts.some((selected) => selected.slug === p.slug)
|
||||||
).slice(0, 9);
|
).slice(0, 9);
|
||||||
@@ -60,6 +61,8 @@ const recentPosts: Post[] = posts.filter(
|
|||||||
title="Recent Posts"
|
title="Recent Posts"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AllPostsSection />
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*'],
|
fields: ['*', 'category.slug'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -30,7 +30,7 @@ const posts = await directus.request(
|
|||||||
const categoriesPosts = posts
|
const categoriesPosts = posts
|
||||||
.sort((a: Post, b: Post) => b.published_date.valueOf() - a.published_date.valueOf())
|
.sort((a: Post, b: Post) => b.published_date.valueOf() - a.published_date.valueOf())
|
||||||
.filter((b) => {
|
.filter((b) => {
|
||||||
return b.category === category.slug;
|
return b.category?.slug === category.slug;
|
||||||
});
|
});
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -65,11 +65,66 @@ const categoriesPosts = posts
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<section class="max-w-340 2xl:max-w-full mb-10 px-4 sm:px-6 lg:px-8 py-8 mx-auto mt-10">
|
<section class="max-w-340 2xl:max-w-full mb-10 px-4 sm:px-6 lg:px-8 py-8 mx-auto mt-10">
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div class="columns-1 sm:columns-2 lg:columns-3 gap-6">
|
||||||
{categoriesPosts.map((b) =>
|
{categoriesPosts.map((b) =>
|
||||||
<BlogCard post={b} />
|
<div class="break-inside-avoid mb-6">
|
||||||
|
<BlogCard post={b} />
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Add smooth reveal animations for content after loading
|
||||||
|
document.addEventListener('astro:page-load', () => {
|
||||||
|
const animateContent = () => {
|
||||||
|
// Animate group 1
|
||||||
|
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
||||||
|
smoothReveal.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
50 + index * 100
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate group 2
|
||||||
|
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
||||||
|
smoothReveal2.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
200 + index * 150
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate topic cards with staggered delay
|
||||||
|
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
||||||
|
smoothRevealCards.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
500 + index * 100
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate with just fade in with staggered delay
|
||||||
|
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
||||||
|
smoothRevealFade.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal-fade');
|
||||||
|
},
|
||||||
|
100 + index * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
animateContent();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { readSingleton } from '@directus/sdk';
|
|||||||
|
|
||||||
import HeroSection from '@components/sections/HeroSection.astro';
|
import HeroSection from '@components/sections/HeroSection.astro';
|
||||||
import CategorySection from '@components/sections/CategorySection.astro';
|
import CategorySection from '@components/sections/CategorySection.astro';
|
||||||
|
import AllCategoriesSection from '@components/sections/AllCategoriesSection.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
|
|
||||||
<CategorySection />
|
<CategorySection />
|
||||||
|
|
||||||
|
<AllCategoriesSection />
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import HeroSection from '@components/sections/HeroSection.astro';
|
|||||||
import FeatureSection from '@components/sections/FeatureSection.astro';
|
import FeatureSection from '@components/sections/FeatureSection.astro';
|
||||||
import WeatherSection from '@components/sections/WeatherSection.astro';
|
import WeatherSection from '@components/sections/WeatherSection.astro';
|
||||||
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
||||||
|
import AllPostsSection from '@components/sections/AllPostsSection.astro';
|
||||||
import GiteaSection from '@components/sections/GiteaSection.astro';
|
import GiteaSection from '@components/sections/GiteaSection.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
@@ -73,6 +74,8 @@ const recentPosts = posts
|
|||||||
subTitle="Checkout my most recent thoughts here"
|
subTitle="Checkout my most recent thoughts here"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AllPostsSection />
|
||||||
|
|
||||||
<GiteaSection
|
<GiteaSection
|
||||||
title="Follow me on Gitea"
|
title="Follow me on Gitea"
|
||||||
subTitle="I love open source and have my code availabile on my Gitea server."
|
subTitle="I love open source and have my code availabile on my Gitea server."
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import { join } from 'node:path';
|
|
||||||
|
|
||||||
function resolveFilePath(path: string) {
|
|
||||||
if (path.startsWith('/')) {
|
|
||||||
return resolveFilePathPublic(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resolveFilePathInternal(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveFilePathPublic(path: string) {
|
|
||||||
return join(process.cwd(), path);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveFilePathInternal(path: string) {
|
|
||||||
const normalizePath = path.startsWith('@') ? path.replace('@', '') : path;
|
|
||||||
|
|
||||||
return join(process.cwd(), 'src/', normalizePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { resolveFilePath, resolveFilePathPublic, resolveFilePathInternal };
|
|
||||||
Reference in New Issue
Block a user