Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRY social icons #644

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove all new social media links to make this pr smaller
  • Loading branch information
onnimonni committed Nov 1, 2024
commit 948004f7d5b056e8955bd19c25bd81a87ecaed3c
27 changes: 1 addition & 26 deletions components/PageSocial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import * as config from '@/lib/config'

import styles from './PageSocial.module.css'
import { FaGithub, FaLinkedin, FaTwitter, FaYoutube } from 'react-icons/fa'
import { FaXTwitter, FaGitlab, FaEnvelopeOpenText } from 'react-icons/fa6'
import { IoIosBug } from 'react-icons/io'
import { FaEnvelopeOpenText } from 'react-icons/fa6'

interface SocialLink {
name: string
Expand All @@ -25,14 +24,6 @@ export const socialLinks: SocialLink[] = [
icon: FaTwitter
},

config.twitterX && {
name: 'twitterX',
href: `https://x.com/${config.twitterX}`,
title: `X @${config.twitterX}`,
color: "#222",
icon: FaXTwitter
},

config.github && {
name: 'github',
href: `https://github.com/${config.github}`,
Expand All @@ -41,14 +32,6 @@ export const socialLinks: SocialLink[] = [
icon: FaGithub
},

config.gitlab && {
name: 'gitlab',
href: `https://gitlab.com/${config.github}`,
title: `GitLab @${config.github}`,
color: "#e24329",
icon: FaGitlab
},

config.linkedin && {
name: 'linkedin',
href: `https://www.linkedin.com/in/${config.linkedin}`,
Expand All @@ -72,14 +55,6 @@ export const socialLinks: SocialLink[] = [
color: "#ff0000",
icon: FaYoutube
},

config.bugtracker && {
name: 'bugtracker',
href: `${config.bugtracker}`,
title: 'Bugtracker',
color: "#e24329",
icon: IoIosBug
}
].filter(Boolean)

export function PageSocial(prefix: string) {
Expand Down
3 changes: 0 additions & 3 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,12 @@ export const language: string = getSiteConfig('language', 'en')

// social accounts
export const twitter: string | null = getSiteConfig('twitter', null)
export const twitterX: string | null = getSiteConfig('twitterX', null)
export const mastodon: string | null = getSiteConfig('mastodon', null)
export const github: string | null = getSiteConfig('github', null)
export const gitlab: string | null = getSiteConfig('gitlab', null)
export const youtube: string | null = getSiteConfig('youtube', null)
export const linkedin: string | null = getSiteConfig('linkedin', null)
export const newsletter: string | null = getSiteConfig('newsletter', null)
export const zhihu: string | null = getSiteConfig('zhihu', null)
export const bugtracker: string | null = getSiteConfig('bugtracker', null)

export const getMastodonHandle = (): string | null => {
if (!mastodon) {
Expand Down
3 changes: 0 additions & 3 deletions lib/site-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ export interface SiteConfig {
language?: string

twitter?: string
twitterX?: string
github?: string
gitlab?: string
linkedin?: string
newsletter?: string
youtube?: string
zhihu?: string
mastodon?: string
bugtracker?: string

defaultPageIcon?: string | null
defaultPageCover?: string | null
Expand Down