Skip to content

Commit

Permalink
Merge pull request #6 from maicss/code-fold
Browse files Browse the repository at this point in the history
feat: code fold
  • Loading branch information
maicss authored Nov 18, 2023
2 parents 2a3c623 + c8aea8b commit 588e86b
Show file tree
Hide file tree
Showing 19 changed files with 1,041 additions and 198 deletions.
86 changes: 86 additions & 0 deletions .gitea/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
# cache: npm # or pnpm / yarn
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with VitePress
run: |
pnpm run build # or pnpm docs:build / yarn docs:build / bun run docs:build
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: .vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
12 changes: 11 additions & 1 deletion .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { defineConfig } from "vitepress";
/// <reference types="vite-svg-loader" />
import { defineConfig } from "vitepress"
import svgLoader from 'vite-svg-loader'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand Down Expand Up @@ -126,5 +128,13 @@ export default defineConfig({
sitemap: {
hostname: "https://maicss.com",
},
transformHead (context) {
console.log('transformHead', context)
},
vite: {
plugins: [svgLoader({
defaultImport: 'component'
})]
},
// buildEnd: genFeed
});
8 changes: 5 additions & 3 deletions .vitepress/theme/BlogIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { useData } from 'vitepress'
import { data } from './blog.data'
import {ref, computed} from 'vue'
import ArrowLeft from './assets/arrow-left.svg'
import ArrowRight from './assets/arrow-right.svg'
const { frontmatter } = useData()
const PRE_PAGE = 15
Expand Down Expand Up @@ -40,11 +42,11 @@ const changePage = (page:number|'prev'|'next') => {
<div class="pagination my-8 select-none" v-if="pageTotal > 1">
<ul class="flex gap-x-4 justify-center items-center">
<li class="bordered rounded w-8 h-8 bg-slate-100 flex justify-center items-center cursor-pointer hover:text-sky-400" @click="changePage('prev')">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" fill="currentColor" /></svg>
<ArrowLeft width="20px"/>
</li>
<li v-for="index in pageTotal" class="bordered rounded w-8 h-8 bg-slate-100 flex justify-center items-center cursor-pointer" :class="[pageCurrent === index ? ' bg-sky-300 text-white' : 'text-black hover:text-sky-300']" @click="changePage(index)">{{ index }}</li>
<li v-for="index in pageTotal" class="bordered rounded w-8 h-8 flex justify-center items-center cursor-pointer" :class="[pageCurrent === index ? ' bg-sky-300 text-white' : 'text-black hover:text-sky-300 bg-slate-100']" @click="changePage(index)">{{ index }}</li>
<li class="bordered rounded w-8 h-8 bg-slate-100 flex justify-center items-center cursor-pointer hover:text-sky-400" @click="changePage('next')">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" fill="currentColor" /></svg>
<ArrowRight width="20px"/>
</li>
</ul>
</div>
Expand Down
6 changes: 0 additions & 6 deletions .vitepress/theme/BlogLayout.vue

This file was deleted.

21 changes: 0 additions & 21 deletions .vitepress/theme/Date.vue

This file was deleted.

Loading

0 comments on commit 588e86b

Please sign in to comment.