Skip to content

Commit 6d02471

Browse files
refactor: extract banners (#74)
1 parent 5cb6036 commit 6d02471

File tree

2 files changed

+43
-35
lines changed

2 files changed

+43
-35
lines changed

src/components/banner.vue

+5-35
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,18 @@
11
<script setup lang="ts">
22
import { Menu } from 'floating-vue'
3+
import { banners } from '../utils/banner'
34
import 'floating-vue/dist/style.css'
45
</script>
56

67
<template>
78
<div flex="~ row gap-2 wrap" justify-center p2>
8-
<a target="_blank" href="https://github.com/opensource-f2f">
9-
<img
10-
alt="GitHub Org's stars"
11-
src="https://img.shields.io/github/stars/opensource-f2f?style=social"
12-
/>
13-
</a>
14-
<a target="_blank" href="https://twitter.com/osf2f">
15-
<img
16-
alt="Twitter followers"
17-
src="https://img.shields.io/twitter/follow/osf2f?style=social"
18-
/>
19-
</a>
20-
<a
21-
target="_blank"
22-
href="https://www.youtube.com/channel/UCV7Ibg1k_aMSEcDFgJvuvdg"
23-
>
24-
<img
25-
alt="YouTube subscribers"
26-
src="https://img.shields.io/youtube/channel/subscribers/UCV7Ibg1k_aMSEcDFgJvuvdg?style=social"
27-
/>
28-
</a>
29-
<a target="_blank" href="https://feeds.osf2f.net/osf2f.xml">
30-
<img
31-
alt="RSS address"
32-
src="https://img.shields.io/badge/rss-F88900?style=flat&logo=rss&logoColor=white"
33-
/>
34-
</a>
359
<a
10+
v-for="(item, key) in banners"
11+
:key="key"
3612
target="_blank"
37-
href="https://open.spotify.com/show/48Yeu1L5pTluk1AVc3ShU6"
13+
:href="item.href"
3814
>
39-
<img
40-
alt="Listen on Spotify"
41-
src="https://img.shields.io/badge/spotify-1DB954?style=flat&logo=spotify&logoColor=white"
42-
/>
43-
</a>
44-
<a target="_blank" href="https://music.163.com/#/djradio?id=1001312291">
45-
<img h-20px alt="NetEase Music" src="/static/netease-music.svg" />
15+
<img :alt="item.alt" :src="item.src" h-20px />
4616
</a>
4717

4818
<Menu>

src/utils/banner.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export interface BannerItem {
2+
alt: string
3+
href: string
4+
src: string
5+
}
6+
7+
export const banners: BannerItem[] = [
8+
{
9+
alt: "GitHub Org's stars",
10+
href: 'https://github.com/opensource-f2f',
11+
src: 'https://img.shields.io/github/stars/opensource-f2f?style=social',
12+
},
13+
{
14+
alt: 'Twitter followers',
15+
href: 'https://twitter.com/osf2f',
16+
src: 'https://img.shields.io/twitter/follow/osf2f?style=social',
17+
},
18+
{
19+
alt: 'YouTube subscribers',
20+
href: 'https://www.youtube.com/channel/UCV7Ibg1k_aMSEcDFgJvuvdg',
21+
src: 'https://img.shields.io/youtube/channel/subscribers/UCV7Ibg1k_aMSEcDFgJvuvdg?style=social',
22+
},
23+
{
24+
alt: 'RSS address',
25+
href: 'https://feeds.osf2f.net/osf2f.xml',
26+
src: 'https://img.shields.io/badge/rss-F88900?style=flat&logo=rss&logoColor=white',
27+
},
28+
{
29+
alt: 'Listen on Spotify',
30+
href: 'https://open.spotify.com/show/48Yeu1L5pTluk1AVc3ShU6',
31+
src: 'https://img.shields.io/badge/spotify-1DB954?style=flat&logo=spotify&logoColor=white',
32+
},
33+
{
34+
alt: 'NetEase Music',
35+
href: 'https://music.163.com/#/djradio?id=1001312291',
36+
src: '/static/netease-music.svg',
37+
},
38+
]

0 commit comments

Comments
 (0)