Compare commits
1 Commits
main
...
9610c33725
| Author | SHA1 | Date | |
|---|---|---|---|
|
9610c33725
|
143
.gitea/workflows/release-image-gitea.yml
Normal file
143
.gitea/workflows/release-image-gitea.yml
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
name: release-image-gitea
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 2.*
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Set up pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10.x
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: 24.14.0
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Lint Code
|
||||||
|
run: pnpm lint
|
||||||
|
|
||||||
|
- name: Build Project
|
||||||
|
run: pnpm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.REPOSITORY_HOST }}
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.REPOSITORY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.DH_REGISTRY }}
|
||||||
|
username: ${{ secrets.DH_USERNAME }}
|
||||||
|
password: ${{ secrets.DH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir $HOME/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: kubernetes
|
||||||
|
driver-opts: |
|
||||||
|
namespace=gitea
|
||||||
|
qemu.install=true
|
||||||
|
buildkitd-config-inline: |
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
||||||
|
|
||||||
|
- name: Available Platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
|
||||||
|
- name: Extract Metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=sha,format=long
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
images: |
|
||||||
|
${{ vars.REPOSITORY_HOST }}/${{ gitea.repository }}
|
||||||
|
|
||||||
|
- name: Get Version Info
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
|
||||||
|
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
if git describe --tags --exact-match HEAD 2>/dev/null; then
|
||||||
|
echo "is_release=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "is_release=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build and Push Image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
|
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
||||||
|
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
|
||||||
|
- name: ntfy Success
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Success - Site Profile'
|
||||||
|
priority: 3
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,successfully,completed
|
||||||
|
details: 'Image for Site Profile has been released!'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
|
||||||
|
- name: ntfy Failed
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Failure - Site Profile'
|
||||||
|
priority: 4
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,failed
|
||||||
|
details: 'Image for Site Profile has failed to be released.'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]'
|
||||||
|
image: true
|
||||||
143
.gitea/workflows/release-image-harbor.yml
Normal file
143
.gitea/workflows/release-image-harbor.yml
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
name: release-image-harbor
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 2.*
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Set up pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10.x
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: 24.14.0
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Lint Code
|
||||||
|
run: pnpm lint
|
||||||
|
|
||||||
|
- name: Build Project
|
||||||
|
run: pnpm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.REGISTRY_HOST }}
|
||||||
|
username: ${{ vars.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_SECRET }}
|
||||||
|
|
||||||
|
- name: Login to Docker
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.DH_REGISTRY }}
|
||||||
|
username: ${{ secrets.DH_USERNAME }}
|
||||||
|
password: ${{ secrets.DH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir $HOME/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: kubernetes
|
||||||
|
driver-opts: |
|
||||||
|
namespace=gitea
|
||||||
|
qemu.install=true
|
||||||
|
buildkitd-config-inline: |
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
||||||
|
|
||||||
|
- name: Available Platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
|
||||||
|
- name: Extract Metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=sha,format=long
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
images: |
|
||||||
|
${{ vars.REGISTRY_HOST }}/images/site-profile
|
||||||
|
|
||||||
|
- name: Get Version Info
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
|
||||||
|
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
if git describe --tags --exact-match HEAD 2>/dev/null; then
|
||||||
|
echo "is_release=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "is_release=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build and Push Image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
|
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
||||||
|
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
|
||||||
|
- name: ntfy Success
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Success - Site Profile'
|
||||||
|
priority: 3
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,successfully,completed
|
||||||
|
details: 'Image for Site Profile has been released!'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
|
||||||
|
- name: ntfy Failed
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Failure - Site Profile'
|
||||||
|
priority: 4
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,failed
|
||||||
|
details: 'Image for Site Profile has failed to be released.'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]'
|
||||||
|
image: true
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
name: release-image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- release
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
ref: release
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 24.14.0
|
|
||||||
|
|
||||||
- name: Set up Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: 1.3.10
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
.astro
|
|
||||||
node_modules/.vite
|
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-astro-
|
|
||||||
|
|
||||||
- name: Lint Code
|
|
||||||
run: bun run lint
|
|
||||||
|
|
||||||
- name: Build Project
|
|
||||||
run: bun run build
|
|
||||||
|
|
||||||
- name: ntfy Failed
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Test Failure - Site Profile'
|
|
||||||
priority: 4
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,failed
|
|
||||||
details: 'During release tests failed for building Site Profile'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yaml", "clear": true}]'
|
|
||||||
image: true
|
|
||||||
|
|
||||||
guarddog:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
ref: release
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: '3.12'
|
|
||||||
|
|
||||||
- name: Install GuardDog
|
|
||||||
run: |
|
|
||||||
python3 -m pip install --upgrade pip
|
|
||||||
python3 -m pip install guarddog
|
|
||||||
|
|
||||||
- name: Run GuardDog
|
|
||||||
run: |
|
|
||||||
guarddog npm scan ./
|
|
||||||
|
|
||||||
- name: ntfy Failed
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Security Failure - Site Profile'
|
|
||||||
priority: 4
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,failed
|
|
||||||
details: 'During release guarddog scan failed for Site Profile'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yaml", "clear": true}]'
|
|
||||||
image: true
|
|
||||||
|
|
||||||
semantic-release:
|
|
||||||
needs: [ build, guarddog ]
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
outputs:
|
|
||||||
new-release-published: ${{ steps.semantic.outputs.new-release-published }}
|
|
||||||
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
|
|
||||||
new-release-git-tag: ${{ steps.semantic.outputs.new-release-git-tag }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
token: ${{ secrets.BOT_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 24.14.0
|
|
||||||
|
|
||||||
- name: Set up Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: 1.3.10
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Run Semantic Release
|
|
||||||
id: semantic
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
||||||
NODE_PATH: ${{ github.workspace }}/node_modules
|
|
||||||
run: |
|
|
||||||
bun run semantic-release
|
|
||||||
|
|
||||||
release-harbor:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
needs: semantic-release
|
|
||||||
if: ${{ needs.semantic-release.outputs.new-release-published == 'true' }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
ref: release
|
|
||||||
|
|
||||||
- name: Login to Harbor Registry
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.REGISTRY_HOST }}
|
|
||||||
username: ${{ vars.REGISTRY_USER }}
|
|
||||||
password: ${{ secrets.REGISTRY_SECRET }}
|
|
||||||
|
|
||||||
- name: Login to Docker
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.DH_REGISTRY }}
|
|
||||||
username: ${{ secrets.DH_USERNAME }}
|
|
||||||
password: ${{ secrets.DH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Kubeconfig
|
|
||||||
run: |
|
|
||||||
mkdir $HOME/.kube
|
|
||||||
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
with:
|
|
||||||
driver: kubernetes
|
|
||||||
driver-opts: |
|
|
||||||
namespace=gitea
|
|
||||||
qemu.install=true
|
|
||||||
buildkitd-config-inline: |
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
|
||||||
|
|
||||||
- name: Available Platforms
|
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
||||||
|
|
||||||
- name: Extract Metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v6
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ vars.REGISTRY_HOST }}/images/site-profile
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=sha,format=long
|
|
||||||
type=raw,value=latest,enable=${{ needs.semantic-release.outputs.new-release-published == 'true' }}
|
|
||||||
type=semver,pattern={{version}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
type=semver,pattern={{major}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
|
|
||||||
- name: Build and Push Image
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
APP_VERSION=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
COMMIT_SHA=${{ github.sha }}
|
|
||||||
IS_RELEASE=true
|
|
||||||
file: ./Dockerfile
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: ntfy Success
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Success - Site Profile'
|
|
||||||
priority: 3
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,successfully,completed
|
|
||||||
details: 'Harbor Image for Site Profile has been released!'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
|
|
||||||
- name: ntfy Failed
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Failure - Site Profile'
|
|
||||||
priority: 4
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,failed
|
|
||||||
details: 'Harbor Image for Site Profile has failed to be released.'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]'
|
|
||||||
image: true
|
|
||||||
|
|
||||||
release-gitea:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
needs: [ semantic-release, release-harbor ]
|
|
||||||
if: |
|
|
||||||
always() &&
|
|
||||||
needs.semantic-release.outputs.new-release-published == 'true'
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
ref: release
|
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.REPOSITORY_HOST }}
|
|
||||||
username: ${{ gitea.actor }}
|
|
||||||
password: ${{ secrets.REPOSITORY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to Docker
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.DH_REGISTRY }}
|
|
||||||
username: ${{ secrets.DH_USERNAME }}
|
|
||||||
password: ${{ secrets.DH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Kubeconfig
|
|
||||||
run: |
|
|
||||||
mkdir $HOME/.kube
|
|
||||||
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
with:
|
|
||||||
driver: kubernetes
|
|
||||||
driver-opts: |
|
|
||||||
namespace=gitea
|
|
||||||
qemu.install=true
|
|
||||||
buildkitd-config-inline: |
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
|
||||||
|
|
||||||
- name: Available Platforms
|
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
||||||
|
|
||||||
- name: Extract Metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v6
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ vars.REPOSITORY_HOST }}/${{ gitea.repository }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=sha,format=long
|
|
||||||
type=raw,value=latest,enable=${{ needs.semantic-release.outputs.new-release-published == 'true' }}
|
|
||||||
type=semver,pattern={{version}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
type=semver,pattern={{major}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
|
|
||||||
- name: Build and Push Image
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
APP_VERSION=${{ needs.semantic-release.outputs.new-release-version }}
|
|
||||||
COMMIT_SHA=${{ github.sha }}
|
|
||||||
IS_RELEASE=true
|
|
||||||
file: ./Dockerfile
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: ntfy Success
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Success - Site Profile'
|
|
||||||
priority: 3
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,successfully,completed
|
|
||||||
details: 'Gitea Image for Site Profile has been released!'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
|
|
||||||
- name: ntfy Failed
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Failure - Site Profile'
|
|
||||||
priority: 4
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,failed
|
|
||||||
details: 'Gitea Image for Site Profile has failed to be released.'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yaml", "clear": true}]'
|
|
||||||
image: true
|
|
||||||
@@ -4,9 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
|
||||||
- '.gitea/workflows/**'
|
|
||||||
- '**.md'
|
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
@@ -19,34 +16,25 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10.x
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
|
cache: pnpm
|
||||||
- name: Set up Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: 1.3.10
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bun install --frozen-lockfile
|
run: pnpm install
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
.astro
|
|
||||||
node_modules/.vite
|
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-astro-
|
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: bun run lint
|
run: pnpm lint
|
||||||
|
|
||||||
- name: Build Project
|
- name: Build Project
|
||||||
run: bun run build
|
run: pnpm build
|
||||||
|
|
||||||
- name: ntfy Failed
|
- name: ntfy Failed
|
||||||
uses: niniyas/ntfy-action@master
|
uses: niniyas/ntfy-action@master
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,6 +10,8 @@ node_modules/
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
.env
|
.env
|
||||||
|
|||||||
3
.npmrc
Normal file
3
.npmrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
registry=https://registry.npmjs.org/
|
||||||
|
engine-strict=true
|
||||||
|
save-exact=true
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"branches": ["release"],
|
|
||||||
"tagFormat": "${version}",
|
|
||||||
"plugins": [
|
|
||||||
"@semantic-release/commit-analyzer",
|
|
||||||
"@semantic-release/release-notes-generator",
|
|
||||||
"@semantic-release/changelog",
|
|
||||||
"semantic-release-export-data",
|
|
||||||
["@semantic-release/npm", { "npmPublish": false }],
|
|
||||||
["@semantic-release/git", {
|
|
||||||
"assets": ["package.json", "CHANGELOG.md"],
|
|
||||||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
||||||
}],
|
|
||||||
["@saithodev/semantic-release-gitea", {
|
|
||||||
"giteaUrl": "https://gitea.alexlebens.dev"
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
31
Dockerfile
31
Dockerfile
@@ -1,35 +1,32 @@
|
|||||||
ARG REGISTRY=dhi.io
|
FROM docker.io/node:24.14.0-alpine AS builder
|
||||||
FROM ${REGISTRY}/bun:1.3.10-alpine3.22-dev AS builder
|
|
||||||
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
COPY package.json bun.lock ./
|
|
||||||
|
|
||||||
FROM builder AS prod-deps
|
FROM builder AS prod-deps
|
||||||
RUN --mount=type=cache,id=bun,target=/root/.bun/install/cache \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||||
bun install --production --frozen-lockfile
|
|
||||||
|
|
||||||
FROM builder AS build-deps
|
FROM prod-deps AS build-deps
|
||||||
RUN --mount=type=cache,id=bun,target=/root/.bun/install/cache \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
bun install --frozen-lockfile
|
|
||||||
|
|
||||||
FROM build-deps AS build
|
FROM build-deps AS build
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN bun run build
|
RUN pnpm run build
|
||||||
|
|
||||||
FROM ${REGISTRY}/bun:1.3.10-alpine3.22 AS runtime
|
FROM dhi.io/node:24.14.0 AS runtime
|
||||||
WORKDIR /app
|
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
|
||||||
|
|
||||||
ARG APP_VERSION=latest
|
LABEL version="2.19.0"
|
||||||
|
LABEL description="Astro based personal website"
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
ENV PORT=4321
|
ENV PORT=4321
|
||||||
|
|
||||||
LABEL version=$APP_VERSION
|
|
||||||
LABEL description="Astro based personal website"
|
|
||||||
|
|
||||||
EXPOSE $PORT
|
EXPOSE $PORT
|
||||||
CMD ["bun", "run", "./dist/server/entry.mjs"]
|
CMD ["node", "./dist/server/entry.mjs"]
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ Personal site used for information about myself and blog.
|
|||||||
|
|
||||||
With dependencies installed, you can utilize the following npm scripts to manage your project's development lifecycle:
|
With dependencies installed, you can utilize the following npm scripts to manage your project's development lifecycle:
|
||||||
|
|
||||||
- `bun run build`: Bundles your site into static files for production.
|
- `pnpm build`: Bundles your site into static files for production.
|
||||||
- `bun run dev`: Starts a local development server with hot reloading enabled.
|
- `pnpm dev`: Starts a local development server with hot reloading enabled.
|
||||||
|
- `pnpm preview`: Serves your build output locally for preview before deployment.
|
||||||
|
|
||||||
For detailed help with Astro CLI commands, visit [Astro's documentation](https://docs.astro.build/en/reference/cli-reference/).
|
For detailed help with Astro CLI commands, visit [Astro's documentation](https://docs.astro.build/en/reference/cli-reference/).
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
import node from '@astrojs/node';
|
import node from '@astrojs/node';
|
||||||
|
import partytown from '@astrojs/partytown';
|
||||||
import react from '@astrojs/react';
|
import react from '@astrojs/react';
|
||||||
import sitemap from '@astrojs/sitemap';
|
import sitemap from '@astrojs/sitemap';
|
||||||
|
|
||||||
@@ -24,7 +25,10 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
prefetch: true,
|
||||||
|
|
||||||
integrations: [
|
integrations: [
|
||||||
|
partytown(),
|
||||||
react(),
|
react(),
|
||||||
sitemap(),
|
sitemap(),
|
||||||
icon({
|
icon({
|
||||||
|
|||||||
41
package.json
41
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "site-profile",
|
"name": "site-profile",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.6.0",
|
"version": "2.19.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",
|
||||||
@@ -19,61 +19,51 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev": "astro dev",
|
||||||
"full-dev": "rm -rf dist node_modules .astro && bun install && astro build && astro dev",
|
|
||||||
"build": "astro build",
|
"build": "astro build",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"full-preview": "rm -rf dist node_modules .astro && bun install && astro build && astro preview",
|
|
||||||
"astro": "astro",
|
"astro": "astro",
|
||||||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,astro}\"",
|
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,astro}\"",
|
||||||
"lint": "eslint \"src/**/*.{js,ts,jsx,tsx,astro}\"",
|
"lint": "eslint \"src/**/*.{js,ts,jsx,tsx,astro}\"",
|
||||||
"lint:fix": "eslint --fix \"src/**/*.{js,ts,jsx,tsx,astro}\""
|
"lint:fix": "eslint --fix \"src/**/*.{js,ts,jsx,tsx,astro}\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.9.7",
|
"@astrojs/check": "^0.9.6",
|
||||||
"@astrojs/node": "^10.0.1",
|
"@astrojs/node": "^9.5.4",
|
||||||
"@astrojs/react": "^5.0.0",
|
"@astrojs/partytown": "^2.1.4",
|
||||||
"@astrojs/rss": "^4.0.17",
|
"@astrojs/react": "^4.4.2",
|
||||||
"@astrojs/sitemap": "^3.7.1",
|
"@astrojs/rss": "^4.0.15",
|
||||||
"@directus/sdk": "^21.2.0",
|
"@astrojs/sitemap": "^3.7.0",
|
||||||
|
"@directus/sdk": "^21.1.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",
|
||||||
"@iconify-json/simple-icons": "^1.2.73",
|
"@iconify-json/simple-icons": "^1.2.72",
|
||||||
"@playform/compress": "^0.2.1",
|
"@playform/compress": "^0.2.1",
|
||||||
"@swup/astro": "^1.8.0",
|
"@swup/astro": "^1.8.0",
|
||||||
"@tailwindcss/postcss": "^4.2.1",
|
"@tailwindcss/postcss": "^4.2.1",
|
||||||
"@tailwindcss/vite": "^4.2.1",
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
"@types/react": "^19.2.14",
|
"@types/react": "^19.2.14",
|
||||||
"@types/unist": "^3.0.3",
|
"@types/unist": "^3.0.3",
|
||||||
"astro": "^6.0.4",
|
"astro": "^5.18.0",
|
||||||
"astro-icon": "^1.1.5",
|
"astro-icon": "^1.1.5",
|
||||||
"dayjs": "^1.11.20",
|
"marked": "^17.0.3",
|
||||||
"markdown-it": "^14.1.1",
|
|
||||||
"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",
|
||||||
"reading-time": "^1.5.0",
|
"reading-time": "^1.5.0",
|
||||||
"sharp": "^0.34.5",
|
"sharp": "^0.34.5",
|
||||||
"sharp-ico": "^0.1.5",
|
"sharp-ico": "^0.1.5",
|
||||||
"shiki": "^4.0.2",
|
"shiki": "^4.0.1",
|
||||||
"tailwindcss": "^4.2.1",
|
"tailwindcss": "^4.2.1",
|
||||||
"ultrahtml": "^1.6.0"
|
"ultrahtml": "^1.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint-react/eslint-plugin": "^2.13.0",
|
"@eslint-react/eslint-plugin": "^2.13.0",
|
||||||
"@saithodev/semantic-release-gitea": "^2.1.0",
|
|
||||||
"@semantic-release/changelog": "^6.0.3",
|
|
||||||
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
||||||
"@semantic-release/git": "^10.0.1",
|
|
||||||
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@types/markdown-it": "^14.1.2",
|
"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",
|
||||||
@@ -83,9 +73,8 @@
|
|||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.1",
|
||||||
"prettier-plugin-astro": "^0.14.1",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||||
"semantic-release": "^25.0.3",
|
"timeago.js": "^4.0.2",
|
||||||
"semantic-release-export-data": "^1.2.0",
|
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.57.0"
|
"typescript-eslint": "^8.56.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12588
pnpm-lock.yaml
generated
Normal file
12588
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
onlyBuiltDependencies:
|
||||||
|
- swup
|
||||||
BIN
public/i.jpg
Normal file
BIN
public/i.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 381 KiB |
4
public/robots.txt
Normal file
4
public/robots.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
User-agent: *
|
||||||
|
Allow: /
|
||||||
|
|
||||||
|
Sitemap: https://www.alexlebens.dev/sitemap-index.xml
|
||||||
@@ -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] transition-all duration-300 w-full px-4 py-3 mx-2 md:mx-8 mt-4"
|
class="nav-base relative md:flex md:items-center md:justify-between rounded-[36px] w-full px-4 mx-2 py-3 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">
|
||||||
@@ -95,3 +95,5 @@ const currentPath = pathname.slice(1);
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<script is:inline src="/vendor/preline/collapse2.1.0.min.js"></script>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
import { Icon } from 'astro-icon/components';
|
|
||||||
---
|
|
||||||
|
|
||||||
<div class="button-base button-bg-teal inline-flex shrink-0 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>
|
|
||||||
@@ -49,88 +49,100 @@
|
|||||||
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||||
document.documentElement.classList.toggle('dark', isDark);
|
document.documentElement.classList.toggle('dark', isDark);
|
||||||
};
|
};
|
||||||
|
|
||||||
applyTheme();
|
applyTheme();
|
||||||
|
|
||||||
|
document.addEventListener('astro:after-swap', applyTheme);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
if (!document.querySelector('.theme-switch-overlay')) {
|
function setupThemeToggle() {
|
||||||
const overlay = document.createElement('div');
|
const themeToggles = document.querySelectorAll('[data-theme-toggle]');
|
||||||
overlay.className = 'theme-switch-overlay fixed inset-0 pointer-events-none z-50';
|
|
||||||
overlay.style.opacity = '0';
|
|
||||||
overlay.style.transition = 'opacity 0.15s ease-out';
|
|
||||||
document.body.appendChild(overlay);
|
|
||||||
}
|
|
||||||
['click', 'touchend'].forEach((eventType) => {
|
|
||||||
document.addEventListener(
|
|
||||||
eventType,
|
|
||||||
(e) => {
|
|
||||||
const target = e.target as HTMLElement;
|
|
||||||
const toggle = target.closest('[data-theme-toggle]');
|
|
||||||
|
|
||||||
if (!toggle) return;
|
// Create theme switch overlay element
|
||||||
|
if (!document.querySelector('.theme-switch-overlay')) {
|
||||||
|
const overlay = document.createElement('div');
|
||||||
|
overlay.className = 'theme-switch-overlay fixed inset-0 pointer-events-none z-50';
|
||||||
|
overlay.style.opacity = '0';
|
||||||
|
overlay.style.transition = 'opacity 0.15s ease-out';
|
||||||
|
document.body.appendChild(overlay);
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
themeToggles.forEach((toggle) => {
|
||||||
|
['click', 'touchend'].forEach((eventType) => {
|
||||||
|
toggle.addEventListener(
|
||||||
|
eventType,
|
||||||
|
(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
let x, y;
|
// Get click/touch position for radial animation
|
||||||
const rect = toggle.getBoundingClientRect();
|
let x, y;
|
||||||
|
if (e.type === 'touchend' && e.changedTouches && e.changedTouches[0]) {
|
||||||
if (eventType === 'touchend') {
|
const rect = toggle.getBoundingClientRect();
|
||||||
const touchEvent = e as TouchEvent;
|
x = e.changedTouches[0].clientX - rect.left;
|
||||||
if (touchEvent.changedTouches && touchEvent.changedTouches[0]) {
|
y = e.changedTouches[0].clientY - rect.top;
|
||||||
x = touchEvent.changedTouches[0].clientX - rect.left;
|
} else {
|
||||||
y = touchEvent.changedTouches[0].clientY - rect.top;
|
const rect = toggle.getBoundingClientRect();
|
||||||
}
|
x = e.clientX - rect.left;
|
||||||
} else {
|
y = e.clientY - rect.top;
|
||||||
const mouseEvent = e as MouseEvent;
|
|
||||||
x = mouseEvent.clientX - rect.left;
|
|
||||||
y = mouseEvent.clientY - rect.top;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.documentElement.style.setProperty('--x', `${x}px`);
|
|
||||||
document.documentElement.style.setProperty('--y', `${y}px`);
|
|
||||||
|
|
||||||
const overlay = document.querySelector('.theme-switch-overlay') as HTMLElement;
|
|
||||||
const isDark = document.documentElement.classList.contains('dark');
|
|
||||||
const newTheme = isDark ? 'light' : 'dark';
|
|
||||||
|
|
||||||
if (overlay) {
|
|
||||||
overlay.style.backgroundColor =
|
|
||||||
newTheme === 'dark' ? 'rgba(24, 24, 27, 0.3)' : 'rgba(255, 255, 255, 0.3)';
|
|
||||||
overlay.style.opacity = '1';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.documentElement.classList.add('theme-switching');
|
|
||||||
|
|
||||||
document.body.offsetHeight;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
if (isDark) {
|
|
||||||
document.documentElement.classList.remove('dark');
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add('dark');
|
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem('theme', newTheme);
|
|
||||||
document.dispatchEvent(
|
|
||||||
new CustomEvent('themeChanged', {
|
|
||||||
detail: { isDark: newTheme === 'dark' },
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
document.body.offsetHeight;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
if (overlay) {
|
|
||||||
overlay.style.opacity = '0';
|
|
||||||
}
|
}
|
||||||
document.documentElement.classList.remove('theme-switching');
|
|
||||||
}, 150);
|
|
||||||
}, 50);
|
|
||||||
},
|
|
||||||
{ passive: false }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
document.documentElement.style.setProperty('--x', `${x}px`);
|
||||||
|
document.documentElement.style.setProperty('--y', `${y}px`);
|
||||||
|
|
||||||
|
const overlay = document.querySelector('.theme-switch-overlay');
|
||||||
|
const isDark = document.documentElement.classList.contains('dark');
|
||||||
|
const newTheme = isDark ? 'light' : 'dark';
|
||||||
|
|
||||||
|
// Show overlay during transition
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.backgroundColor =
|
||||||
|
newTheme === 'dark' ? 'rgba(24, 24, 27, 0.3)' : 'rgba(255, 255, 255, 0.3)';
|
||||||
|
overlay.style.opacity = '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
document.documentElement.classList.add('theme-switching');
|
||||||
|
|
||||||
|
// Force a reflow to ensure all elements update
|
||||||
|
document.body.offsetHeight;
|
||||||
|
|
||||||
|
// Toggle dark mode with a slight delay to allow overlay to appear
|
||||||
|
setTimeout(() => {
|
||||||
|
if (isDark) {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem('theme', newTheme);
|
||||||
|
document.dispatchEvent(
|
||||||
|
new CustomEvent('themeChanged', {
|
||||||
|
detail: { isDark: newTheme === 'dark' },
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force another reflow to ensure all elements update
|
||||||
|
document.body.offsetHeight;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.opacity = '0';
|
||||||
|
}
|
||||||
|
document.documentElement.classList.remove('theme-switching');
|
||||||
|
}, 150);
|
||||||
|
}, 50);
|
||||||
|
},
|
||||||
|
{ passive: false }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run setup on load
|
||||||
|
document.addEventListener('astro:page-load', setupThemeToggle);
|
||||||
|
|
||||||
|
// Also run on page visibility change to ensure theme is consistent
|
||||||
document.addEventListener('visibilitychange', () => {
|
document.addEventListener('visibilitychange', () => {
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible') {
|
||||||
const currentTheme = localStorage.getItem('theme');
|
const currentTheme = localStorage.getItem('theme');
|
||||||
@@ -142,6 +154,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Listen for system preference changes
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches }) => {
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches }) => {
|
||||||
if (!localStorage.getItem('theme')) {
|
if (!localStorage.getItem('theme')) {
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
import { formatDate } from '@support/time';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -15,13 +16,13 @@ const { post } = Astro.props;
|
|||||||
|
|
||||||
<div class="smooth-reveal-cards group flex flex-col">
|
<div class="smooth-reveal-cards group flex flex-col">
|
||||||
<a
|
<a
|
||||||
class="card-base border-none! h-full flex flex-col"
|
class="card-base border-none!"
|
||||||
href={`/blog/${post.slug}/`}
|
href={`/blog/${post.slug}/`}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="relative shrink-0 rounded-t-xl w-full overflow-hidden before:absolute before:inset-x-0 before:z-1 before:size-full">
|
<div class="relative shrink-0 rounded-t-xl w-full overflow-hidden before:absolute before:inset-x-0 before:z-1 before:size-full">
|
||||||
<Image
|
<Image
|
||||||
class="rounded-t-xl h-64 w-full object-cover"
|
class="rounded-t-xl h-auto w-full"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(post.image)}
|
||||||
alt={post.image_alt}
|
alt={post.image_alt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
@@ -30,17 +31,25 @@ const { post } = Astro.props;
|
|||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col flex-1 rounded-xl p-4 md:p-5 mx-1 mb-2">
|
<div class="rounded-xl p-4 md:p-5">
|
||||||
<div class="flex flex-row items-center mb-8">
|
<h3 class="card-text-title text-xl">
|
||||||
<h3 class="card-text-title card-hover-text-title text-2xl">
|
{post.title}
|
||||||
{post.title}
|
</h3>
|
||||||
</h3>
|
<div class="ml-6 flex">
|
||||||
</div>
|
<div class="relative inline-block w-full">
|
||||||
<div class="mt-auto">
|
<div class="card-text-title card-hover-text-title flex relative items-center mx-auto min-h-11 sm:mx-0 sm:mt-4">
|
||||||
<PostMetadataSnippet
|
<span class="relative inline-block overflow-hidden ml-2">
|
||||||
enableCategoryLink={false}
|
Read more
|
||||||
post={post}
|
</span>
|
||||||
/>
|
<Icon
|
||||||
|
name="mdi:keyboard-arrow-right"
|
||||||
|
class="translate-y-0.5 transition duration-300 group-hover:translate-x-1"
|
||||||
|
/>
|
||||||
|
<p class="card-text-description text-sm ml-auto">
|
||||||
|
{formatDate(post.published_date)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="relative grow overflow-hidden">
|
<div class="relative grow overflow-hidden">
|
||||||
<div class="mask-fade-edges absolute inset-1 flex flex-col p-3 md:p-4 lg:p-5">
|
<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 shrink-0">
|
<div class="flex flex-row items-center mb-4">
|
||||||
<div class="card-hover-icon-scale shrink-0 mr-3">
|
<div class="card-hover-icon-scale shrink-0 mr-3">
|
||||||
<Logo
|
<Logo
|
||||||
srcLight={getDirectusImageURL(logoLight)}
|
srcLight={getDirectusImageURL(logoLight)}
|
||||||
@@ -35,12 +35,12 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
{title}
|
{title}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-hidden">
|
<div>
|
||||||
<p class="card-text-description line-clamp-3">
|
<p class="card-text-description mb-4">
|
||||||
{description}
|
{description}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-text-description flex shrink-0 items-center justify-between text-xs mt-auto pt-1 md:pt-2">
|
<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">
|
<span class="inline-flex items-center">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@@ -55,7 +55,7 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
</svg>
|
</svg>
|
||||||
{count}
|
{count}
|
||||||
</span>
|
</span>
|
||||||
<div class="inline-flex items-center">
|
<span class="inline-flex items-center">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="16"
|
width="16"
|
||||||
@@ -68,10 +68,8 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
<circle cx="12" cy="12" r="10"></circle>
|
<circle cx="12" cy="12" r="10"></circle>
|
||||||
<polyline points="12 6 12 12 16 14"></polyline>
|
<polyline points="12 6 12 12 16 14"></polyline>
|
||||||
</svg>
|
</svg>
|
||||||
<span>
|
{publishDate}
|
||||||
{publishDate}
|
</span>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,50 +1,53 @@
|
|||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
|
||||||
|
|
||||||
import ReadMoreButton from '@components/buttons/ReadMoreButton.astro';
|
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
post: Post;
|
title: string;
|
||||||
|
subTitle: string;
|
||||||
|
url: string;
|
||||||
|
img: string;
|
||||||
|
imgAlt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { post } = Astro.props;
|
const { title, subTitle, url, img, imgAlt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto">
|
||||||
<a
|
<a
|
||||||
class="md:card-base-hidden group 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"
|
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"
|
||||||
href={`/blog/${post.slug}`}
|
href={url}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="h-full">
|
<div>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full object-cover"
|
class="rounded-2xl rounded-b-none md:rounded-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(img)}
|
||||||
alt={post.image_alt}
|
alt={imgAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="850"
|
||||||
|
height="420"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col justify-center 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 gap-4">
|
<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">
|
<h2 class="card-text-header mb-2">
|
||||||
{post.title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose">
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
{post.description}
|
{subTitle}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex md:flex-col-reverse lg:flex-row items-center md:items-start lg:items-center justify-between w-full md:gap-4">
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
<div class="hidden md:block shrink-0 mt-4">
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
<ReadMoreButton/>
|
<span class="mr-2">
|
||||||
</div>
|
Read More
|
||||||
<div class="mt-2 lg:mt-4">
|
</span>
|
||||||
<PostMetadataSnippet
|
<Icon
|
||||||
post={post}
|
name="mdi:keyboard-arrow-right"
|
||||||
enableCategoryLink={false}
|
class="button-hover-arrow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,85 +1,85 @@
|
|||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
|
||||||
|
|
||||||
import ReadMoreButton from '@components/buttons/ReadMoreButton.astro';
|
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
post: Post;
|
title: string;
|
||||||
|
subTitle: string;
|
||||||
|
url: string;
|
||||||
|
single?: boolean;
|
||||||
|
imgOne: any;
|
||||||
|
imgOneAlt: any;
|
||||||
|
imgTwo?: any;
|
||||||
|
imgTwoAlt?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { post } = Astro.props;
|
const { title, subTitle, url, single, imgOne, imgOneAlt, imgTwo, imgTwoAlt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
<div class="smooth-reveal flex flex-col px-5 py-10 mx-auto">
|
||||||
<a
|
<a
|
||||||
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"
|
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"
|
||||||
href={`/blog/${post.slug}`}
|
href={url}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="flex flex-col 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 gap-4">
|
<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">
|
<h2 class="card-text-header mb-2">
|
||||||
{post.title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose">
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
{post.description}
|
{subTitle}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex md:flex-col-reverse lg:flex-row items-center md:items-start lg:items-center justify-between w-full md:gap-4">
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
<div class="hidden md:block shrink-0 mt-4">
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
<ReadMoreButton/>
|
<span class="mr-2">
|
||||||
</div>
|
Read More
|
||||||
<div class="mt-2 lg:mt-4">
|
</span>
|
||||||
<PostMetadataSnippet
|
<Icon
|
||||||
post={post}
|
name="mdi:keyboard-arrow-right"
|
||||||
enableCategoryLink={false}
|
class="button-hover-arrow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{!post.image_second ? (
|
{single ? (
|
||||||
<div class="h-full">
|
<div>
|
||||||
<Image
|
<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"
|
class="rounded-2xl rounded-b-none md:rounded-2xl w-full"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(imgOne)}
|
||||||
alt={post.image_alt}
|
alt={imgOneAlt}
|
||||||
draggable="false"
|
format="webp"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="850"
|
||||||
|
height="420"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div class="h-full">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<div class="md:hidden">
|
<Image
|
||||||
<Image
|
class="rounded-xl w-full"
|
||||||
class="rounded-2xl rounded-b-none shadow-2xl w-full h-full sm:max-h-80 object-cover"
|
src={getDirectusImageURL(imgOne)}
|
||||||
src={getDirectusImageURL(post.image)}
|
alt={imgOneAlt}
|
||||||
alt={post.image_alt}
|
draggable="false"
|
||||||
draggable="false"
|
format="webp"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
inferSize={true}
|
width="400"
|
||||||
/>
|
height="230"
|
||||||
</div>
|
inferSize={true}
|
||||||
<div class="hidden md:flex md:items-start">
|
/>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-xl z-10 shadow-2xl w-3/5 h-full object-cover"
|
class="rounded-xl w-full mt-4 lg:mt-10"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(imgTwo)}
|
||||||
alt={post.image_alt}
|
alt={imgTwoAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
format="webp"
|
||||||
inferSize={true}
|
loading="lazy"
|
||||||
/>
|
width="400"
|
||||||
<Image
|
height="230"
|
||||||
class="rounded-xl shadow-2xl w-3/5 h-full -ml-16 mt-12 object-cover"
|
inferSize={true}
|
||||||
src={getDirectusImageURL(post.image_second)}
|
/>
|
||||||
alt={post.image_second_alt}
|
|
||||||
draggable="false"
|
|
||||||
loading="lazy"
|
|
||||||
inferSize={true}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
---
|
|
||||||
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-cards 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>
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
---
|
|
||||||
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>
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
import ReadMoreButton from '@components/buttons/ReadMoreButton.astro';
|
|
||||||
import Logo from '@components/images/Logo.astro';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
title: string;
|
|
||||||
subTitle: string;
|
|
||||||
url: string;
|
|
||||||
logoLight: string;
|
|
||||||
logoDark?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { title, subTitle, url, logoLight, logoDark} = Astro.props;
|
|
||||||
---
|
|
||||||
|
|
||||||
<div class="smooth-reveal w-full mx-auto">
|
|
||||||
<a
|
|
||||||
class="card-base group flex flex-row items-center justify-between w-full p-8 gap-6 md:gap-8"
|
|
||||||
href={url}
|
|
||||||
data-astro-prefetch
|
|
||||||
>
|
|
||||||
<div class="flex flex-row items-center ml-4">
|
|
||||||
<div class="card-hover-icon-scale shrink-0 mr-3">
|
|
||||||
<Logo
|
|
||||||
srcLight={getDirectusImageURL(logoLight)}
|
|
||||||
srcDark={getDirectusImageURL(logoDark!)}
|
|
||||||
alt={`Logo of ${title}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-3 text-left ml-4">
|
|
||||||
<h2 class="card-text-header text-2xl md:text-3xl">
|
|
||||||
{title}
|
|
||||||
</h2>
|
|
||||||
<p class="card-text-title font-light text-pretty text-lg max-w-3xl">
|
|
||||||
{subTitle}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="hidden md:block shrink-0 mr-4">
|
|
||||||
<ReadMoreButton/>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@@ -10,7 +10,7 @@ const { dayName, label, icon, temp } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal-2 group flex flex-col">
|
<div class="smooth-reveal-2 group flex flex-col">
|
||||||
<div class="card-base w-32 sm:w-40">
|
<div class="card-base w-32 md:w-40">
|
||||||
<div class="p-5 text-center">
|
<div class="p-5 text-center">
|
||||||
<span class="card-text-description block font-bold text-xs uppercase tracking-widest">
|
<span class="card-text-description block font-bold text-xs uppercase tracking-widest">
|
||||||
{dayName}
|
{dayName}
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
---
|
---
|
||||||
import { readItems, readSingleton } from '@directus/sdk';
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post, Category } from '@lib/directusTypes';
|
||||||
|
|
||||||
import CategoryCard from '@components/cards/CategoryCard.astro';
|
import CategoryCard from '@components/cards/CategoryCard.astro';
|
||||||
import LargeCategoryCard from '@components/cards/LargeCategoryCard.astro';
|
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
import { formatFromNow } from '@support/time';
|
import { timeago } from '@support/time';
|
||||||
|
|
||||||
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: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -34,16 +31,13 @@ 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) => {
|
||||||
const categorySlug = obj.category?.slug;
|
let posts = acc.get(obj.category);
|
||||||
if (!categorySlug) return acc;
|
|
||||||
|
|
||||||
let posts = acc.get(categorySlug);
|
|
||||||
if (!posts) {
|
if (!posts) {
|
||||||
posts = [];
|
posts = [];
|
||||||
}
|
}
|
||||||
posts.push(obj);
|
posts.push(obj);
|
||||||
|
|
||||||
acc.set(categorySlug, posts);
|
acc.set(obj.category, posts);
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, new Map<string, Post[]>());
|
}, new Map<string, Post[]>());
|
||||||
@@ -93,21 +87,10 @@ const categories = (await directus.request(readItems('categories')))
|
|||||||
logoLight={category.logoLight}
|
logoLight={category.logoLight}
|
||||||
logoDark={category.logoDark}
|
logoDark={category.logoDark}
|
||||||
count={postMap.get(category.slug)?.length ?? 0}
|
count={postMap.get(category.slug)?.length ?? 0}
|
||||||
publishDate={formatFromNow(postMap.get(category.slug)?.[0]?.published_date)}
|
publishDate={timeago(postMap.get(category.slug)?.[0]?.published_date)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<div class="col-span-full mt-8">
|
|
||||||
<LargeCategoryCard
|
|
||||||
title="All Posts"
|
|
||||||
description="Here you can forgoe the organization and browse everything I've posted"
|
|
||||||
url="/all"
|
|
||||||
logoLight={global.all_logoLight}
|
|
||||||
logoDark={global.all_logoDark}
|
|
||||||
count={posts.length}
|
|
||||||
publishDate={formatFromNow(posts[0]?.published_date)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import directus from '@lib/directus';
|
|||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="max-w-340 2xl:max-w-full px-4 py-10 mx-auto mb-2 md:mb-8">
|
<section class="max-w-340 2xl:max-w-full px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto mb-2 md:mb-8">
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex flex-col sm:flex-row items-center justify-center gap-y-2 sm:gap-x-12 sm:gap-y-0 lg:gap-x-24">
|
||||||
<div class="max-w-5xl">
|
<div class="max-w-5xl sm:px-6 lg:px-8">
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6">
|
<div class="flex flex-wrap gap-6 sm:grid-cols-2 sm:gap-6 lg:grid-cols-3 justify-center">
|
||||||
<FeaturesCard
|
<FeaturesCard
|
||||||
title="Cloud Engineer"
|
title="Cloud Engineer"
|
||||||
description="Full stack and cloud engineer."
|
description="Full stack and cloud engineer."
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
---
|
---
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
import { readItems } from '@directus/sdk';
|
|
||||||
|
|
||||||
import type { HeaderImage } from '@lib/directusTypes';
|
|
||||||
|
|
||||||
import GoLinkPrimaryButton from '@components/buttons/GoLinkPrimaryButton.astro';
|
import GoLinkPrimaryButton from '@components/buttons/GoLinkPrimaryButton.astro';
|
||||||
import GoLinkSecondaryButton from '@components/buttons/GoLinkSecondaryButton.astro';
|
import GoLinkSecondaryButton from '@components/buttons/GoLinkSecondaryButton.astro';
|
||||||
import directus from '@lib/directus';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -16,24 +11,18 @@ interface Props {
|
|||||||
primaryBtnURL?: string;
|
primaryBtnURL?: string;
|
||||||
secondaryBtn?: string;
|
secondaryBtn?: string;
|
||||||
secondaryBtnURL?: string;
|
secondaryBtnURL?: string;
|
||||||
|
src?: any;
|
||||||
|
alt?: string;
|
||||||
|
rounded?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, subTitle, primaryBtn, primaryBtnURL, secondaryBtn, secondaryBtnURL } = Astro.props;
|
const { title, subTitle, primaryBtn, primaryBtnURL, secondaryBtn, secondaryBtnURL, src, alt } = Astro.props;
|
||||||
|
|
||||||
const imagesData = ((await directus.request(
|
const roundedClasses = Astro.props.rounded ? "rounded-2xl" : null;
|
||||||
readItems('header_images', {
|
|
||||||
fields: ['*'],
|
|
||||||
})
|
|
||||||
)) as unknown) as HeaderImage[];
|
|
||||||
|
|
||||||
const images = await Promise.all(imagesData.map(async (img) => ({
|
|
||||||
...img,
|
|
||||||
src: await getDirectusImageURL(img.image)
|
|
||||||
})));
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="grid md:grid-cols-2 md:items-center gap-4 md:gap-8 max-w-340 2xl:max-w-full px-4 py-14 sm:px-6 lg:px-8">
|
<section class="mx-auto grid max-w-340 gap-4 px-4 py-14 sm:px-6 md:grid-cols-2 md:items-center md:gap-8 lg:px-8 2xl:max-w-full">
|
||||||
<div class="md:ml-12">
|
<div>
|
||||||
<h1 class="smooth-reveal card-text-header block lg:text-7xl">
|
<h1 class="smooth-reveal card-text-header block lg:text-7xl">
|
||||||
<Fragment set:html={title} />
|
<Fragment set:html={title} />
|
||||||
</h1>
|
</h1>
|
||||||
@@ -47,62 +36,22 @@ const images = await Promise.all(imagesData.map(async (img) => ({
|
|||||||
{secondaryBtn && <GoLinkSecondaryButton title={secondaryBtn} url={secondaryBtnURL} />}
|
{secondaryBtn && <GoLinkSecondaryButton title={secondaryBtn} url={secondaryBtnURL} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="smooth-reveal-fade md:block w-full hidden md:mr-12">
|
|
||||||
<div
|
<div class="smooth-reveal-fade md:block w-full hidden">
|
||||||
class="flex justify-center w-full top-12 md:ml-4 overflow-hidden no-js-fallback"
|
<div class="flex justify-center w-full top-12 md:ml-4 overflow-hidden">
|
||||||
id="hero-image-container"
|
{src && alt && (
|
||||||
>
|
<Image
|
||||||
{images.map((img, index) => (
|
src={src}
|
||||||
<div
|
alt={alt}
|
||||||
class="hero-image hidden justify-center w-full h-full"
|
class={`h-full w-105 scale-100 object-cover object-center ${roundedClasses}`}
|
||||||
data-index={index}
|
draggable="false"
|
||||||
>
|
loading="eager"
|
||||||
<Image
|
format="webp"
|
||||||
class="h-full w-105 scale-100 object-cover object-center"
|
quality="low"
|
||||||
src={img.src}
|
widths={[840]}
|
||||||
alt={img.image_alt}
|
inferSize={true}
|
||||||
draggable="false"
|
/>
|
||||||
loading="eager"
|
)}
|
||||||
format="webp"
|
|
||||||
widths={[840]}
|
|
||||||
inferSize={true}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
<style>
|
|
||||||
.no-js-fallback .hero-image:first-child {
|
|
||||||
display: flex !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script is:inline>
|
|
||||||
document.getElementById('hero-image-container')?.classList.remove('no-js-fallback');
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script>
|
|
||||||
function initHeroImage() {
|
|
||||||
const container = document.getElementById('hero-image-container');
|
|
||||||
if (container) {
|
|
||||||
const images = container.querySelectorAll('.hero-image');
|
|
||||||
images.forEach(img => {
|
|
||||||
img.classList.remove('flex');
|
|
||||||
img.classList.add('hidden');
|
|
||||||
});
|
|
||||||
if (images.length > 0) {
|
|
||||||
const randomIndex = Math.floor(Math.random() * images.length);
|
|
||||||
images[randomIndex].classList.remove('hidden');
|
|
||||||
images[randomIndex].classList.add('flex');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (document.readyState === 'loading') {
|
|
||||||
document.addEventListener('DOMContentLoaded', initHeroImage);
|
|
||||||
} else {
|
|
||||||
initHeroImage();
|
|
||||||
}
|
|
||||||
if ((window as any).swup) {
|
|
||||||
(window as any).swup.hooks.on('page:view', initHeroImage);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { readSingleton } from '@directus/sdk';
|
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import BlogCard from '@components/cards/BlogCard.astro';
|
import BlogCard from '@components/cards/BlogCard.astro';
|
||||||
import LargeLinkCard from '@components/cards/LargeLinkCard.astro';
|
|
||||||
import directus from '@lib/directus';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
@@ -13,12 +9,10 @@ interface Props {
|
|||||||
subTitle?: string;
|
subTitle?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
|
||||||
|
|
||||||
const { posts, title, subTitle } = Astro.props;
|
const { posts, title, subTitle } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="max-w-340 2xl:max-w-full px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto mb-2 md:mb-4">
|
<section class="max-w-340 2xl:max-w-full px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto mb-2 md:mb-8">
|
||||||
<div class="text-center max-w-2xl mx-auto mb-10 lg:mb-14">
|
<div class="text-center max-w-2xl mx-auto mb-10 lg:mb-14">
|
||||||
<h1 class="smooth-reveal card-text-header block">
|
<h1 class="smooth-reveal card-text-header block">
|
||||||
{title}
|
{title}
|
||||||
@@ -29,18 +23,7 @@ const { posts, title, subTitle } = Astro.props;
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
{posts.map((b) =>
|
{posts.map((b) => <BlogCard post={b} />)}
|
||||||
<BlogCard post={b} />
|
</div>
|
||||||
)}
|
|
||||||
<div class="col-span-full">
|
|
||||||
<LargeLinkCard
|
|
||||||
title="All Posts"
|
|
||||||
subTitle="Catch up on everything I've written"
|
|
||||||
url="/all"
|
|
||||||
logoLight={global.all_logoLight}
|
|
||||||
logoDark={global.all_logoDark}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -11,10 +11,25 @@ interface Props {
|
|||||||
const { posts } = Astro.props;
|
const { posts } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="smooth-reveal-cards flex flex-col gap-4 md:mb-20">
|
<section class="smooth-reveal flex flex-col gap-4">
|
||||||
{posts.map((post, index) => index % 2 === 0 ? (
|
{posts.map((post, index) => index % 2 === 0 ? (
|
||||||
<LargeBlogLeftCard post={post}/>
|
<LargeBlogLeftCard
|
||||||
|
title={post.title}
|
||||||
|
subTitle={post.description}
|
||||||
|
url={`/blog/${post.slug}`}
|
||||||
|
img={post.image}
|
||||||
|
imgAlt={post.image_alt}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<LargeBlogRightCard post={post}/>
|
<LargeBlogRightCard
|
||||||
|
title={post.title}
|
||||||
|
subTitle={post.description}
|
||||||
|
url={`/blog/${post.slug}`}
|
||||||
|
single={!post.image_second}
|
||||||
|
imgOne={post.image}
|
||||||
|
imgOneAlt={post.image_alt}
|
||||||
|
imgTwo={post?.image_second}
|
||||||
|
imgTwoAlt={post?.image_second_alt}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -20,19 +20,17 @@ const { forecastDays, error } = await getFiveDayForecast(latitude, longitude, ti
|
|||||||
</div>
|
</div>
|
||||||
{error ? (
|
{error ? (
|
||||||
<div class="card-base p-10 text-accent text-center">
|
<div class="card-base p-10 text-accent text-center">
|
||||||
Sorry, {error.toLowerCase()}
|
{error}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div class="flex flex-wrap justify-center gap-4 lg:gap-6">
|
<div class="flex flex-wrap justify-center gap-4 lg:gap-6">
|
||||||
{forecastDays.map((forecastDay, index) => (
|
{forecastDays.map((forecastDay) => (
|
||||||
<div class={index === 3 ? "hidden min-[800px]:block" : index >= 4 ? "hidden min-[1100px]:block" : ""}>
|
<WeatherCard
|
||||||
<WeatherCard
|
dayName={forecastDay.dayName}
|
||||||
dayName={forecastDay.dayName}
|
label={forecastDay.label}
|
||||||
label={forecastDay.label}
|
icon={forecastDay.icon}
|
||||||
icon={forecastDay.icon}
|
temp={forecastDay.temp}
|
||||||
temp={forecastDay.temp}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
---
|
|
||||||
import getReadingTime from 'reading-time';
|
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
|
||||||
|
|
||||||
import Logo from '@components/images/Logo.astro';
|
|
||||||
import { formatShortDate, formatDate } from '@support/time';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
post: Post;
|
|
||||||
enableCategoryLink?: boolean;
|
|
||||||
dateFormat?: 'short' | 'long';
|
|
||||||
}
|
|
||||||
|
|
||||||
const { post, enableCategoryLink = true, dateFormat = 'short' } = Astro.props;
|
|
||||||
|
|
||||||
const readingTime = getReadingTime(post.content || '');
|
|
||||||
---
|
|
||||||
|
|
||||||
<ol class="flex items-center justify-start card-text-description text-sm whitespace-nowrap gap-2 sm:gap-0 overflow-hidden">
|
|
||||||
{post.category && (
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
{enableCategoryLink ? (
|
|
||||||
<a
|
|
||||||
class="inline-flex items-center hover:card-hover-text-description overflow-hidden"
|
|
||||||
href={`/categories/${post.category.slug}`}
|
|
||||||
data-astro-prefetch
|
|
||||||
>
|
|
||||||
<div class="flex flex-row items-center shrink-0">
|
|
||||||
<div class="mr-2">
|
|
||||||
<Logo
|
|
||||||
srcLight={getDirectusImageURL(post.category.logoLight)}
|
|
||||||
srcDark={getDirectusImageURL(post.category.logoDark)}
|
|
||||||
alt={`Logo of ${post.category.title}`}
|
|
||||||
width={18}
|
|
||||||
height={18}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{post.category.title}
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
<div class="inline-flex items-center overflow-hidden">
|
|
||||||
<div class="flex flex-row items-center shrink-0">
|
|
||||||
<div class="mr-2">
|
|
||||||
<Logo
|
|
||||||
srcLight={getDirectusImageURL(post.category.logoLight)}
|
|
||||||
srcDark={getDirectusImageURL(post.category.logoDark)}
|
|
||||||
alt={`Logo of ${post.category.title}`}
|
|
||||||
width={18}
|
|
||||||
height={18}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{post.category.title}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 mx-2">
|
|
||||||
/
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 overflow-hidden">
|
|
||||||
{dateFormat === 'short' ? formatShortDate(post.published_date) : formatDate(post.published_date)}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 mx-2">
|
|
||||||
/
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 overflow-hidden">
|
|
||||||
{readingTime.minutes.toPrecision(1)} minutes
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
BIN
src/images/autumn_bench.png
Normal file
BIN
src/images/autumn_bench.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 MiB |
BIN
src/images/autumn_mountain.png
Normal file
BIN
src/images/autumn_mountain.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 MiB |
BIN
src/images/autumn_tree.png
Normal file
BIN
src/images/autumn_tree.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 MiB |
BIN
src/images/cedar_tree.png
Normal file
BIN
src/images/cedar_tree.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 MiB |
BIN
src/images/portrait.avif
Normal file
BIN
src/images/portrait.avif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
import { ClientRouter } from 'astro:transitions';
|
||||||
import { readSingleton } from '@directus/sdk';
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
import BaseHead from '@components/BaseHead.astro';
|
import BaseHead from '@components/BaseHead.astro';
|
||||||
@@ -38,7 +39,8 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
structuredData={structuredData}
|
structuredData={structuredData}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Set Theme -->
|
<ClientRouter fallback="swap" />
|
||||||
|
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
const theme = (() => {
|
const theme = (() => {
|
||||||
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
||||||
@@ -58,12 +60,6 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
window.localStorage.setItem('theme', theme);
|
window.localStorage.setItem('theme', theme);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Preline -->
|
|
||||||
<script
|
|
||||||
src="/vendor/preline/collapse2.1.0.min.js"
|
|
||||||
is:inline
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Rybbit Tracking Snippet -->
|
<!-- Rybbit Tracking Snippet -->
|
||||||
<script
|
<script
|
||||||
src="https://rybbit.alexlebens.dev/api/script.js"
|
src="https://rybbit.alexlebens.dev/api/script.js"
|
||||||
@@ -72,111 +68,67 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
/>
|
/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="bg-background selection:bg-yellow-400 m-0 p-0 overflow-hidden">
|
<body class="bg-background selection:bg-yellow-400 m-0 p-0 overflow-x-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"/>
|
||||||
|
|
||||||
<!-- Fixed header -->
|
<!-- Layout -->
|
||||||
<Header />
|
<div class="grow w-full max-w-(--breakpoint-2xl) px-4 sm:px-6 lg:px-8 py-20 mx-auto">
|
||||||
|
|
||||||
<!-- Main body -->
|
<Header />
|
||||||
<div id="reset-scroll" class="mask-container w-screen h-screen overflow-y-auto overflow-x-hidden">
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<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 class="has-js scroll-fade-container min-h-screen">
|
||||||
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Footer />
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const resetScroll = () => {
|
document.addEventListener('astro:page-load', () => {
|
||||||
const scrollContainer = document.getElementById('reset-scroll');
|
const onScroll = () => {
|
||||||
if (scrollContainer) {
|
document.documentElement.style.setProperty('--scroll-offset', `${window.scrollY}px`);
|
||||||
scrollContainer.scrollTop = 0;
|
document.documentElement.classList.add('has-js');
|
||||||
}
|
};
|
||||||
};
|
|
||||||
resetScroll();
|
|
||||||
|
|
||||||
document.addEventListener('swup:page:view', () => {
|
window.removeEventListener('scroll', onScroll);
|
||||||
resetScroll();
|
window.addEventListener('scroll', onScroll, { passive: true });
|
||||||
if (typeof (window as any).HSStaticMethods !== 'undefined') {
|
|
||||||
(window as any).HSStaticMethods.autoInit();
|
onScroll();
|
||||||
}
|
|
||||||
if (typeof (window as any).rybbit === 'function') {
|
|
||||||
(window as any).rybbit('trackPageview');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
|
||||||
const animateContent = () => {
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
}, 50 + index * 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
}, 200 + index * 250);
|
|
||||||
});
|
|
||||||
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
}, 400 + index * 250);
|
|
||||||
});
|
|
||||||
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
}, 100 + index * 250);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
|
|
||||||
document.addEventListener('swup:page:view', animateContent);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Fade away content below header when scrolling */
|
/* Fade away content below header when scrolling */
|
||||||
.mask-container {
|
.has-js .scroll-fade-container {
|
||||||
-webkit-mask-image: linear-gradient(
|
-webkit-mask-image: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
transparent 0px,
|
transparent 0px,
|
||||||
transparent 90px,
|
transparent 16px,
|
||||||
black 140px,
|
black 80px,
|
||||||
black 100%
|
black 100%
|
||||||
);
|
);
|
||||||
|
|
||||||
mask-image: linear-gradient(
|
mask-image: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
transparent 0px,
|
transparent 0px,
|
||||||
transparent 90px,
|
transparent 16px,
|
||||||
black 140px,
|
black 60px,
|
||||||
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 */
|
||||||
@@ -197,9 +149,9 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(.dark) .bg {
|
:global(.dark) .bg {
|
||||||
--bg-primary: #3b3836;
|
--bg-primary: #332f2e;
|
||||||
--bg-secondary: #332f2e;
|
--bg-secondary: #44403c;
|
||||||
--bg-tertiary: #44403c;
|
--bg-tertiary: #57534e;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg2 {
|
.bg2 {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import type {
|
|||||||
Weather,
|
Weather,
|
||||||
Post,
|
Post,
|
||||||
Category,
|
Category,
|
||||||
HeaderImage,
|
|
||||||
Application,
|
Application,
|
||||||
Experience,
|
Experience,
|
||||||
Education,
|
Education,
|
||||||
@@ -21,7 +20,6 @@ type Schema = {
|
|||||||
site_weather: Weather;
|
site_weather: Weather;
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
categories: Category[];
|
categories: Category[];
|
||||||
header_images: HeaderImage[];
|
|
||||||
site_applications: Application;
|
site_applications: Application;
|
||||||
site_experience: Experience;
|
site_experience: Experience;
|
||||||
site_education: Education;
|
site_education: Education;
|
||||||
|
|||||||
@@ -10,10 +10,16 @@ export type Global = {
|
|||||||
site_url: string;
|
site_url: string;
|
||||||
rybbit_site_id: string;
|
rybbit_site_id: string;
|
||||||
logo: string;
|
logo: string;
|
||||||
all_logoLight: string;
|
|
||||||
all_logoDark: string;
|
|
||||||
portrait: string;
|
portrait: string;
|
||||||
portrait_alt: string;
|
portrait_alt: string;
|
||||||
|
home_image: string;
|
||||||
|
home_image_alt: string;
|
||||||
|
blog_image: string;
|
||||||
|
blog_image_alt: string;
|
||||||
|
categories_image: string;
|
||||||
|
categories_image_alt: string;
|
||||||
|
applications_image: string;
|
||||||
|
applications_image_alt: string;
|
||||||
footer_image: string;
|
footer_image: string;
|
||||||
footer_image_alt: string;
|
footer_image_alt: string;
|
||||||
};
|
};
|
||||||
@@ -31,7 +37,7 @@ export type Post = {
|
|||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
category: Category;
|
category: string;
|
||||||
selected: boolean;
|
selected: boolean;
|
||||||
published: boolean;
|
published: boolean;
|
||||||
content: string;
|
content: string;
|
||||||
@@ -51,12 +57,6 @@ export type Category = {
|
|||||||
logoDark: string;
|
logoDark: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HeaderImage = {
|
|
||||||
id: string;
|
|
||||||
image: string;
|
|
||||||
image_alt: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Application = {
|
export type Application = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -86,6 +86,24 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const randomFact = funFacts[Math.floor(Math.random() * funFacts.length)];
|
const randomFact = funFacts[Math.floor(Math.random() * funFacts.length)];
|
||||||
funFactElement.textContent = randomFact;
|
funFactElement.textContent = randomFact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
},
|
||||||
|
100 + index * 150
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
animateContent();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import SkillsSliderSection from '@components/sections/SkillsSliderSection.astro'
|
|||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
import portraitImg from '@images/portrait.avif';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -35,6 +37,9 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
<HeroSection
|
<HeroSection
|
||||||
title="About Me"
|
title="About Me"
|
||||||
subTitle={global.about}
|
subTitle={global.about}
|
||||||
|
src={portraitImg}
|
||||||
|
alt={global.portrait_alt}
|
||||||
|
rounded={true}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<section class="max-w-7xl px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto">
|
<section class="max-w-7xl px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto">
|
||||||
@@ -47,3 +52,33 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Add smooth reveal animations for content after loading
|
||||||
|
document.addEventListener('astro:page-load', () => {
|
||||||
|
const animateContent = () => {
|
||||||
|
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
||||||
|
smoothReveal.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
50 + 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>
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
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: ['*', { category: ['*'] }],
|
|
||||||
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 posts 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="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
||||||
{posts.map((b) =>
|
|
||||||
<BlogCard post={b} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</BaseLayout>
|
|
||||||
@@ -6,6 +6,8 @@ import ApplicationSection from '@components/sections/ApplicationSection.astro';
|
|||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
import applicationImg from '@images/cedar_tree.png';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -32,8 +34,30 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
<HeroSection
|
<HeroSection
|
||||||
title="Applications"
|
title="Applications"
|
||||||
subTitle={global.about_applications}
|
subTitle={global.about_applications}
|
||||||
|
src={applicationImg}
|
||||||
|
alt={global.applications_image_alt}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ApplicationSection className="smooth-reveal-2" />
|
<ApplicationSection className="smooth-reveal-2" />
|
||||||
|
|
||||||
</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
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
animateContent();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
import getReadingTime from 'reading-time';
|
||||||
import { marked } from 'marked';
|
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 PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
import Logo from '@components/images/Logo.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
import { formatDate } from '@support/time';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
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,
|
||||||
@@ -26,6 +25,14 @@ 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(
|
||||||
|
readItems('categories', {
|
||||||
|
filter: { slug: { _eq: post.category },},
|
||||||
|
limit: 1,
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const readingTime = getReadingTime(post.content || '');
|
||||||
|
|
||||||
const highlighter = await createHighlighter({
|
const highlighter = await createHighlighter({
|
||||||
themes: ['github-light', 'github-dark'],
|
themes: ['github-light', 'github-dark'],
|
||||||
@@ -96,12 +103,46 @@ const content = marked.parse(post.content || '');
|
|||||||
<h2 class="card-text-header block">
|
<h2 class="card-text-header block">
|
||||||
{post.title}
|
{post.title}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="mt-4 sm:mt-6">
|
<ol class="flex items-center justify-center sm:justify-start whitespace-nowrap gap-2 sm:gap-0 mt-6 sm:mt-4">
|
||||||
<PostMetadataSnippet
|
{category && (
|
||||||
post={post}
|
<li class="inline-flex items-center">
|
||||||
dateFormat='long'
|
<a
|
||||||
/>
|
class="inline-flex items-center text-secondary hover:text-secondary-hover text-sm transition-all duration-300"
|
||||||
</div>
|
href=`/categories/${category.slug}`
|
||||||
|
data-astro-prefetch
|
||||||
|
>
|
||||||
|
<div class="flex flex-row items-center shrink-0">
|
||||||
|
<div class="mr-2">
|
||||||
|
<Logo
|
||||||
|
srcLight={getDirectusImageURL(category.logoLight)}
|
||||||
|
srcDark={getDirectusImageURL(category.logoDark)}
|
||||||
|
alt={`Logo of ${category.title}`}
|
||||||
|
width = 18,
|
||||||
|
height = 18,
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{category.title}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<span class="shrink-0 text-secondary text-sm mx-2 sm:mx-4">
|
||||||
|
/
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
<li class="inline-flex items-center">
|
||||||
|
<span class="shrink-0 text-secondary text-sm">
|
||||||
|
{formatDate(post.published_date)}
|
||||||
|
</span>
|
||||||
|
<span class="shrink-0 text-secondary text-sm mx-2 sm:mx-4">
|
||||||
|
/
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="inline-flex items-center">
|
||||||
|
<span class="shrink-0 text-secondary text-sm">
|
||||||
|
{readingTime.minutes.toPrecision(1)} minutes to read
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-t border-divider mt-10 mb-10"/>
|
<div class="border-t border-divider mt-10 mb-10"/>
|
||||||
|
|
||||||
@@ -141,37 +182,20 @@ const content = marked.parse(post.content || '');
|
|||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PhotoSwipeLightbox from 'photoswipe/lightbox';
|
// Add smooth reveal animations for content after loading
|
||||||
const prose = document.querySelector('.prose');
|
document.addEventListener('astro:page-load', () => {
|
||||||
if (prose) {
|
const animateContent = () => {
|
||||||
const images = prose.querySelectorAll('img');
|
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
||||||
images.forEach((img) => {
|
smoothReveal.forEach((el, index) => {
|
||||||
if (img.closest('a')) return;
|
setTimeout(
|
||||||
const link = document.createElement('a');
|
() => {
|
||||||
link.href = img.src;
|
el.classList.add('animate-reveal');
|
||||||
link.dataset.pswpSrc = img.src;
|
},
|
||||||
link.dataset.pswpWidth = img.naturalWidth.toString();
|
100 + index * 100
|
||||||
link.dataset.pswpHeight = img.naturalHeight.toString();
|
);
|
||||||
link.target = '_blank';
|
});
|
||||||
link.classList.add('pswp-link');
|
};
|
||||||
|
|
||||||
img.parentNode?.insertBefore(link, img);
|
animateContent();
|
||||||
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();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -9,16 +9,18 @@ import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
|||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
import blogImg from '@images/autumn_tree.png';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
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: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectedPosts: Post[] = posts.filter((p) => p.selected).slice(0, 4);
|
const selectedPosts: Post[] = posts.filter((p) => p.selected).slice(0, 3);
|
||||||
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);
|
||||||
@@ -47,6 +49,8 @@ const recentPosts: Post[] = posts.filter(
|
|||||||
<HeroSection
|
<HeroSection
|
||||||
title="Blog"
|
title="Blog"
|
||||||
subTitle={global.about_blog}
|
subTitle={global.about_blog}
|
||||||
|
src={blogImg}
|
||||||
|
alt={global.blog_image_alt}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SelectedPostsSection posts={selectedPosts} />
|
<SelectedPostsSection posts={selectedPosts} />
|
||||||
@@ -57,3 +61,56 @@ const recentPosts: Post[] = posts.filter(
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</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');
|
||||||
|
},
|
||||||
|
200 + index * 300
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate group 2
|
||||||
|
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
||||||
|
smoothReveal2.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
500 + index * 100
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate topic cards with staggered delay
|
||||||
|
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
||||||
|
smoothRevealCards.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
1000 + index * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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>
|
||||||
|
|||||||
@@ -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: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
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?.slug === category.slug;
|
return b.category === category.slug;
|
||||||
});
|
});
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -65,11 +65,9 @@ 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="columns-1 sm:columns-2 lg:columns-3 gap-6">
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
{categoriesPosts.map((b) =>
|
{categoriesPosts.map((b) =>
|
||||||
<div class="break-inside-avoid mb-6">
|
<BlogCard post={b} />
|
||||||
<BlogCard post={b} />
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import CategorySection from '@components/sections/CategorySection.astro';
|
|||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
import categoryImg from '@images/autumn_bench.png';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -32,8 +34,63 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
<HeroSection
|
<HeroSection
|
||||||
title="Categories"
|
title="Categories"
|
||||||
subTitle={global.about_categories}
|
subTitle={global.about_categories}
|
||||||
|
src={categoryImg}
|
||||||
|
alt={global.categories_image_alt}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CategorySection />
|
<CategorySection />
|
||||||
|
|
||||||
</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>
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ 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';
|
||||||
|
|
||||||
|
import homeImg from '@images/autumn_mountain.png';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
const weather = await directus.request(readSingleton('site_weather'));
|
const weather = await directus.request(readSingleton('site_weather'));
|
||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -51,16 +53,12 @@ const recentPosts = posts
|
|||||||
subTitle={global.about_description}
|
subTitle={global.about_description}
|
||||||
primaryBtn="About Me"
|
primaryBtn="About Me"
|
||||||
primaryBtnURL="/about"
|
primaryBtnURL="/about"
|
||||||
|
src={homeImg}
|
||||||
|
alt={global.home_image_alt}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FeatureSection />
|
<FeatureSection />
|
||||||
|
|
||||||
<RecentPostsSection
|
|
||||||
posts={recentPosts}
|
|
||||||
title="Latest Posts"
|
|
||||||
subTitle="Checkout my most recent thoughts here"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<WeatherSection
|
<WeatherSection
|
||||||
server:defer
|
server:defer
|
||||||
latitude={weather.latitude}
|
latitude={weather.latitude}
|
||||||
@@ -69,6 +67,12 @@ const recentPosts = posts
|
|||||||
timezone={weather.timezone}
|
timezone={weather.timezone}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<RecentPostsSection
|
||||||
|
posts={recentPosts}
|
||||||
|
title="Latest Posts"
|
||||||
|
subTitle="Checkout my most recent thoughts here"
|
||||||
|
/>
|
||||||
|
|
||||||
<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."
|
||||||
@@ -76,3 +80,62 @@ const recentPosts = posts
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</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 * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate topic cards with staggered delay
|
||||||
|
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
||||||
|
smoothRevealCards.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
400 + index * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
animateContent();
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(document.body, { childList: true, subtree: true });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import rss, { type RSSFeedItem } from '@astrojs/rss';
|
|||||||
import type { APIContext } from 'astro';
|
import type { APIContext } from 'astro';
|
||||||
import { transform, walk } from 'ultrahtml';
|
import { transform, walk } from 'ultrahtml';
|
||||||
import sanitize from 'ultrahtml/transformers/sanitize';
|
import sanitize from 'ultrahtml/transformers/sanitize';
|
||||||
import MarkdownIt from 'markdown-it';
|
|
||||||
|
|
||||||
import { readItems, readSingleton } from '@directus/sdk';
|
import { readItems, readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
@@ -14,8 +12,6 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
|
|
||||||
export async function GET(context: APIContext) {
|
export async function GET(context: APIContext) {
|
||||||
let baseUrl = context.site?.href || global.site_url;
|
let baseUrl = context.site?.href || global.site_url;
|
||||||
const parser = new MarkdownIt();
|
|
||||||
|
|
||||||
if (baseUrl.at(-1) === '/') {
|
if (baseUrl.at(-1) === '/') {
|
||||||
baseUrl = baseUrl.slice(0, -1);
|
baseUrl = baseUrl.slice(0, -1);
|
||||||
}
|
}
|
||||||
@@ -30,7 +26,7 @@ export async function GET(context: APIContext) {
|
|||||||
|
|
||||||
const feedItems: RSSFeedItem[] = [];
|
const feedItems: RSSFeedItem[] = [];
|
||||||
for (const post of posts) {
|
for (const post of posts) {
|
||||||
const content = await transform(parser.render(post.content), [
|
const content = await transform(post.content.replace(/^<!DOCTYPE html>/, ''), [
|
||||||
async (node) => {
|
async (node) => {
|
||||||
await walk(node, (node) => {
|
await walk(node, (node) => {
|
||||||
if (node.name === 'a' && node.attributes.href?.startsWith('/')) {
|
if (node.name === 'a' && node.attributes.href?.startsWith('/')) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
@utility card-hover-icon-scale {
|
@utility card-hover-icon-scale {
|
||||||
@apply transition-transform duration-300 will-change-transform
|
@apply transition-transform duration-300 will-change-transform
|
||||||
drop-shadow-md dark:drop-shadow-xl dark:drop-shadow-neutral-500/60
|
drop-shadow-md dark:drop-shadow-xl dark:drop-shadow-neutral-500/60
|
||||||
group-hover:scale-3d group-hover:scale-105
|
group-hover:scale-3d group-hover:scale-110
|
||||||
}
|
}
|
||||||
|
|
||||||
@utility card-text-header {
|
@utility card-text-header {
|
||||||
@@ -127,26 +127,9 @@
|
|||||||
@apply text-secondary
|
@apply text-secondary
|
||||||
}
|
}
|
||||||
|
|
||||||
@utility card-hover-text-description {
|
|
||||||
@apply transition-all duration-300
|
|
||||||
text-secondary-hover
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
@utility nav-base {
|
@utility nav-base {
|
||||||
@apply border border-neutral-100 dark:border-stone-500/20
|
@apply border border-neutral-100 dark:border-stone-500/20
|
||||||
bg-neutral-100 dark:bg-neutral-800
|
bg-neutral-100 dark:bg-neutral-800
|
||||||
shadow-xs dark:shadow-md
|
shadow-xs dark:shadow-md
|
||||||
}
|
}
|
||||||
|
|
||||||
@utility mask-fade-edges {
|
|
||||||
-webkit-mask-image:
|
|
||||||
linear-gradient(to right, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent),
|
|
||||||
linear-gradient(to bottom, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent);
|
|
||||||
mask-image:
|
|
||||||
linear-gradient(to right, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent),
|
|
||||||
linear-gradient(to bottom, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent);
|
|
||||||
|
|
||||||
-webkit-mask-composite: source-in;
|
|
||||||
mask-composite: intersect;
|
|
||||||
}
|
|
||||||
|
|||||||
50
src/support/animation.ts
Normal file
50
src/support/animation.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
// 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 * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animate topic cards with staggered delay
|
||||||
|
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
||||||
|
smoothRevealCards.forEach((el, index) => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
},
|
||||||
|
400 + index * 250
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
});
|
||||||
21
src/support/paths.ts
Normal file
21
src/support/paths.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
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 };
|
||||||
@@ -1,13 +1,34 @@
|
|||||||
import dayjs from 'dayjs';
|
import { format, register } from 'timeago.js';
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
const TimeAgoConfiguration: string[][] = [
|
||||||
|
['today', 'today'],
|
||||||
|
['%s seconds ago', 'in %s seconds'],
|
||||||
|
['1 minute ago', 'in 1 minute'],
|
||||||
|
['%s minutes ago', 'in %s minutes'],
|
||||||
|
['1 hour ago', 'in 1 hour'],
|
||||||
|
['%s hours ago', 'in %s hours'],
|
||||||
|
['1 day ago', 'in 1 day'],
|
||||||
|
['%s days ago', 'in %s days'],
|
||||||
|
['1 week ago', 'in 1 week'],
|
||||||
|
['%s weeks ago', 'in %s weeks'],
|
||||||
|
['1 month ago', 'in 1 month'],
|
||||||
|
['%s months ago', 'in %s months'],
|
||||||
|
['1 year ago', 'in 1 year'],
|
||||||
|
['%s years ago', 'in %s years'],
|
||||||
|
];
|
||||||
|
|
||||||
function formatFromNow(date: Date | null): string {
|
function timeago(date?: Date): string {
|
||||||
if (!date) {
|
if (!date) {
|
||||||
return 'none';
|
return 'today';
|
||||||
}
|
}
|
||||||
return dayjs(date).fromNow()
|
|
||||||
|
const localeFunc = (number: number, index: number, _?: number): [string, string] => {
|
||||||
|
return TimeAgoConfiguration[index] as [string, string];
|
||||||
|
};
|
||||||
|
|
||||||
|
register('timeago', localeFunc);
|
||||||
|
|
||||||
|
return format(date, 'timeago');
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(date: Date): string {
|
function formatDate(date: Date): string {
|
||||||
@@ -18,11 +39,4 @@ function formatDate(date: Date): string {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatShortDate(date: Date): string {
|
export { formatDate, timeago };
|
||||||
return new Date(date).toLocaleDateString('en-US', {
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export { formatFromNow, formatDate, formatShortDate, };
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const getSiteURL = () => {
|
|||||||
return 'https://www.alexlebens.dev';
|
return 'https://www.alexlebens.dev';
|
||||||
};
|
};
|
||||||
|
|
||||||
function getDirectusImageURL(image: string) {
|
async function getDirectusImageURL(image: string) {
|
||||||
return `${getDirectusURL()}/assets/${image}`;
|
return `${getDirectusURL()}/assets/${image}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user