Skip to content

Commit 21445bd

Browse files
committed
Add socials to footer
1 parent bebaa8c commit 21445bd

File tree

4 files changed

+82
-16
lines changed

4 files changed

+82
-16
lines changed

src/components/Footer.astro

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
11
---
2-
import { CONTACT_EMAIL, CONTACT_NAME } from "../consts";
2+
import { CONTACT_EMAIL, CONTACT_NAME, SOCIAL_MEDIA_LINKS } from "../consts";
33
---
44

55
<footer>
6-
<p class="contact-header">Contact</p>
7-
<p class="contact-name">{CONTACT_NAME}</p>
8-
<p>Email: <a href={`mailto:${CONTACT_EMAIL}`}>{CONTACT_EMAIL}</a></p>
6+
<div>
7+
<p class="contact-header">Contact</p>
8+
<p class="contact-name">{CONTACT_NAME}</p>
9+
<p>Email: <a href={`mailto:${CONTACT_EMAIL}`}>{CONTACT_EMAIL}</a></p>
10+
</div>
11+
<div class="social-links">
12+
<p class="contact-header">Follow us</p>
13+
{
14+
SOCIAL_MEDIA_LINKS.map(({ faClass, link, hoverText: footerText }) => (
15+
<div>
16+
<a href={link}>
17+
{footerText}: {" "}<i class={`social-media-icon ${faClass}`} />
18+
</a>
19+
</div>
20+
))
21+
}
22+
</div>
923
</footer>
1024

11-
<style>
25+
<style lang="scss">
26+
@import "../styles/common.scss";
27+
1228
footer {
1329
margin-top: 2rem;
1430
padding-top: 0.8rem;
1531
padding-bottom: 0.8rem;
1632
color: rgba(var(--fg-color), 0.7); /* Mute the text */
1733
border-top: solid;
1834
border-color: var(--divider-color); /* Don't mute the border */
35+
36+
display: flex;
37+
38+
// For phones, put Contact section above Follow us section
39+
flex-direction: column;
40+
41+
// For laptops, put Contact and Follow us side-by-side
42+
@media (min-width: $tabletMinWidth) {
43+
flex-direction: row;
44+
}
1945
}
2046

2147
.contact-header {
@@ -25,4 +51,22 @@ import { CONTACT_EMAIL, CONTACT_NAME } from "../consts";
2551
.contact-name {
2652
margin: 0;
2753
}
54+
55+
.social-links {
56+
// For phones, Follow us is below Contact. But for laptops, they're side-by-side,
57+
// so the Follow us section needs to be right-aligned
58+
@media (min-width: $tabletMinWidth) {
59+
margin-left: auto;
60+
}
61+
62+
font-size: 1.1rem;
63+
64+
a {
65+
text-decoration: none !important;
66+
}
67+
}
68+
69+
.social-media-icon {
70+
font-size: 1.25rem;
71+
}
2872
</style>

src/components/header/tablet/Menu.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { PAGES, SOCIAL_MEDIA_ICONS } from "../../../consts";
2+
import { PAGES, SOCIAL_MEDIA_LINKS } from "../../../consts";
33
import HeaderLink from "../HeaderLink.astro";
44
import MenuItem from "./MenuItem.astro";
55
import ThemeDropdown from "./ThemeDropdown.astro";
@@ -11,8 +11,8 @@ import ThemeDropdown from "./ThemeDropdown.astro";
1111
</nav>
1212
<div class="text-start social-media-icons">
1313
{
14-
SOCIAL_MEDIA_ICONS.map(({ faClass, link, title }) => (
15-
<HeaderLink link={link} title={title}>
14+
SOCIAL_MEDIA_LINKS.map(({ faClass, link, hoverText }) => (
15+
<HeaderLink link={link} title={hoverText}>
1616
<i class={`social-media-icon ${faClass}`} />
1717
</HeaderLink>
1818
))

src/consts.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,37 @@ export const PAGES = [
1313
{ link: "/blog", name: "Blog", leetName: "B10G" },
1414
] as const;
1515

16-
export const SOCIAL_MEDIA_ICONS = [
16+
interface SocialMediaLink {
17+
/**
18+
* FontAwesome classes to use for the icon
19+
*/
20+
faClass: string;
21+
link: string;
22+
hoverText: string;
23+
/**
24+
* Text to use when displaying in the footer. This is different from the
25+
* hovertext because the hovertext can be more descriptive.
26+
*/
27+
footerText: string;
28+
}
29+
30+
export const SOCIAL_MEDIA_LINKS: SocialMediaLink[] = [
1731
{
1832
faClass: "fab fa-github",
1933
link: "https://github.com/gems-cyberlang",
20-
title: "CYB3RL4NG's GitHub organization",
34+
hoverText: "GitHub organization",
35+
footerText: "GitHub",
2136
},
2237
{
2338
faClass: "fab fa-instagram",
2439
link: "https://instagram.com/cyb3rl4ng",
25-
title: "CYB3RL4NG's Instagram",
40+
hoverText: "Instagram",
41+
footerText: "Instagram",
2642
},
2743
{
2844
faClass: "fa-solid fa-rss",
2945
link: "/feed.xml",
30-
title: "RSS feed",
46+
hoverText: "RSS feed for our blog",
47+
footerText: "RSS feed",
3148
},
3249
];

src/layouts/BaseLayout.astro

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,20 @@ if (!title && frontmatter && "title" in frontmatter) {
7575
padding-left: 5vw;
7676
padding-right: 5vw;
7777

78-
@media (min-width: $laptopMinWidth) {
79-
padding-left: 10vw;
80-
padding-right: 10vw;
78+
@media (min-width: $tabletMinWidth) {
79+
padding-left: 12vw;
80+
padding-right: 12vw;
8181
}
8282

83-
@media (min-width: $bigLaptopWidth) {
83+
@media (min-width: $laptopMinWidth) {
8484
padding-left: 15vw;
8585
padding-right: 15vw;
8686
}
87+
88+
@media (min-width: $bigLaptopWidth) {
89+
padding-left: 24vw;
90+
padding-right: 24vw;
91+
}
8792
}
8893

8994
:global(body > div) {

0 commit comments

Comments
 (0)