Skip to content

Commit

Permalink
feat: 添加GitHub Chart组件
Browse files Browse the repository at this point in the history
This commit closes #72.

Signed-off-by: crrashh1542 <[email protected]>
  • Loading branch information
crrashh1542 committed May 4, 2024
1 parent 2952b11 commit 205611a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,19 @@ export default {
// banner 横幅下的由组件组成的内容区,内容顺序分先后
components: {

// GitHub Charts
ghChart: {
// 贡献表的标题
title: '今天咕咕咕了没!',
// 此处填写 GitHub 用户名
username: 'crrashh1542'
},

// 个人其他网站链接
links: {

// 链接组件的标题
title: '咱的好东西',
title: '咱的好东西',

to: [
// 此处的每一个对象(用大括号包起来的东西)对应一个内容区的灰色背景链接
Expand Down
13 changes: 13 additions & 0 deletions src/components/main/GhChart.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
interface Props {
username: string
}
const { username } = Astro.props
import Card from './Card.astro'
---

<Card isMulti>
<img src={ 'https://ghchart.rshah.org/f59f17/' + username }
alt="crrashh1542's GitHub chart"
class="block m-auto overflow-x-scroll" />
</Card>
7 changes: 7 additions & 0 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import DataTransfer from '@/components/DataTransfer.astro'
// 引入页面模块
import Links from '@/components/main/Links.astro'
import GhChart from '@/components/main/GhChart.astro'
import Properties from '@/components/main/Properties.astro'
---

Expand All @@ -24,6 +25,12 @@ import Properties from '@/components/main/Properties.astro'
<main>
<Banner info={ config.site } social={ config.social } />

<!-- 组件1 GitHub Chart -->
<div class="component-wrapper">
<Catalog>{ config.components.ghChart.title }</Catalog>
<GhChart username={ config.components.ghChart.username }></GhChart>
</div>

<!-- 组件1 个人链接 -->
<div class="component-wrapper">
<Catalog>{ config.components.links.title }</Catalog>
Expand Down

0 comments on commit 205611a

Please sign in to comment.