Skip to content

Commit 49c9609

Browse files
committed
feat(component): add component AppFooter
1 parent a88f12f commit 49c9609

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

src/components/AppFooter.astro

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
import CounterAnalytics from '@/components/analytics/CounterAnalytics.astro'
3+
import GoogleAnalytics from '@/components/analytics/GoogleAnalytics.astro'
4+
import Swetrix from '@/components/analytics/Swetrix.astro'
5+
import Icon from '@/components/Icon.astro'
6+
import siteConfig from '@/configs/site'
7+
import { getPluginConfig, isPluginEnabled } from '@/utils/plugin'
8+
9+
const { author } = siteConfig
10+
const { name, nickname, email, homepage, github, twitter, telegram, reddit } =
11+
author
12+
const socialNetworks: Record<string, string> = {
13+
github,
14+
twitter,
15+
telegram,
16+
reddit,
17+
}
18+
---
19+
20+
<footer class="my-9 text-primary">
21+
<div class="flex justify-center items-center mb-3">
22+
<a href={`mailto:${email}`} class="footer-icon">
23+
<Icon name={'bi:envelope-fill'} size={32} />
24+
</a>
25+
{
26+
Object.keys(socialNetworks).map((network: string) => (
27+
<a href={socialNetworks[network]} class="footer-icon">
28+
<Icon name={`bi:${network}`} size={32} />
29+
</a>
30+
))
31+
}
32+
</div>
33+
<div class="flex justify-center items-center">
34+
Built with
35+
<span class="px-2">
36+
<Icon name="bi:suit-heart-fill" />
37+
</span>
38+
by
39+
<span class="px-2">
40+
<a href={homepage}>{nickname} ({name})</a>.
41+
</span>
42+
</div>
43+
</footer>
44+
{
45+
isPluginEnabled('googleAnalytics') ? (
46+
<GoogleAnalytics {...getPluginConfig('googleAnalytics')} />
47+
) : (
48+
''
49+
)
50+
}
51+
{isPluginEnabled('swetrix') ? <Swetrix {...getPluginConfig('swetrix')} /> : ''}
52+
{
53+
isPluginEnabled('counterAnalytics') ? (
54+
<CounterAnalytics {...getPluginConfig('counterAnalytics')} />
55+
) : (
56+
''
57+
)
58+
}
59+
60+
<style>
61+
a.footer-icon {
62+
@apply text-primary hover:text-secondary mx-1;
63+
}
64+
</style>

src/layouts/AppLayout.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import AppFooter from '@/components/AppFooter.astro'
23
import AppHeader from '@/components/AppHeader.astro'
34
import SEOMeta from '@/components/SEOMeta.astro'
45
import siteConfig from '@/configs/site'
@@ -30,5 +31,6 @@ const pageDescription =
3031
<body class="max-w-8xl mx-auto bg-site-bg">
3132
<AppHeader class={headerCssClasses} />
3233
<slot />
34+
<AppFooter />
3335
</body>
3436
</html>

0 commit comments

Comments
 (0)