Skip to content

Commit

Permalink
Merge pull request #54 from yunu7067/develop
Browse files Browse the repository at this point in the history
components refactoring and deploy actions bug fix
  • Loading branch information
yunu7067 authored Nov 17, 2022
2 parents c10a6de + 5f1bb0a commit fde539c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [main]
# branches: [main]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

Expand All @@ -24,6 +24,10 @@ jobs:
uses: withastro/action@v0
- name: Copy Search Index Files
run: cp -rf ./public/search-index ./dist/
- name: ReUpload Pages Artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./dist/

deploy:
needs: build
Expand Down
17 changes: 4 additions & 13 deletions src/components/blog/BlogPreview.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
import {Picture} from '@astrojs/image/components';
import type {PostInstance} from '$types';
import {classes, getLongDateString} from '$utils';
import {Picture} from '@astrojs/image/components';
import Tags from '$coms/blog/Tags.astro';
import {getLongDateString} from '$utils';
import config from '$config';
export interface Props {
Expand Down Expand Up @@ -73,17 +74,7 @@ for (let i = 0; i < posts.length; i++) {
)}

{/* Tags */}
{post.frontmatter.tags && (
<ul class='mt-4 flex flex-row gap-1.5 flex-wrap'>
{post.frontmatter.tags?.map(tag => (
<li class='tag clickable dark:clickable-dark'>
<a class='block px-2.5 py-1.5' href={`/tag/${tag}`}>
{tag}
</a>
</li>
))}
</ul>
)}
<Tags tags={post.frontmatter.tags} />
</section>
))
}
Expand Down
21 changes: 21 additions & 0 deletions src/components/blog/Tags.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
interface Props {
tags: string[];
}
const {tags} = Astro.props;
---

{
tags && (
<ul class='mt-4 flex flex-row gap-1.5 flex-wrap'>
{tags.map(tag => (
<li class='tag clickable dark:clickable-dark'>
<a class='block px-2.5 py-1.5' href={`/tag/${tag}`}>
{tag}
</a>
</li>
))}
</ul>
)
}
19 changes: 5 additions & 14 deletions src/layouts/BlogLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import BlogAuthor from '$coms/blog/Author.astro';
import BlogComment from '$coms/blog/Comment.astro';
import TableOfContents from '$coms/blog/TableOfContents.astro';
import BlogViews from '$coms/blog/BlogViews';
import Tags from '$coms/blog/Tags.astro';
import {classes, getLongDateString} from '$utils';
import config from '$config';
import '$styles/article.scss';
Expand Down Expand Up @@ -77,20 +78,10 @@ const props = {
<BlogViews client:load namespace={config.baseurl} key={decodeURI(pathname)} />
</div>
</div>

{/* Tags */}
{
frontmatter.tags && (
<ul class='mb-4 flex flex-row gap-1.5 flex-wrap'>
{frontmatter.tags?.map(tag => (
<li class='tag clickable dark:clickable-dark'>
<a class='block px-2.5 py-1.5' href={`/tag/${tag}`}>
{tag}
</a>
</li>
))}
</ul>
)
}
<Tags tags={frontmatter.tags} />

<BlogAuthor
avatar={config.avatar}
name={config.author.name}
Expand All @@ -101,7 +92,7 @@ const props = {
{/* Hero */}
{
frontmatter.heroImageMetadata && (
<div class={classes('flex items-center justify-center')}>
<div class='flex items-center justify-center'>
<div
class={classes(
'max-w-4xl w-full max-h-[28rem] h-full m-4 overflow-hidden',
Expand Down

0 comments on commit fde539c

Please sign in to comment.