Skip to main content

Overview

The SocialLinks component renders social media icons that link to external profiles. It uses react-icons for icon rendering and includes hover effects with Spotify green. File: src/app/components/SocialLinks.tsx

Component

src/app/components/SocialLinks.tsx
import { ReactNode } from "react";
import Link from "next/link";
import { FaLinkedin } from "react-icons/fa6";
import { FaGithub } from "react-icons/fa6";
import { FaSquareXTwitter } from "react-icons/fa6";

export default function SocialLinks() {
  return (
    <>
      {socialMedias.map((social) => (
        <Link
          href={social.url}
          className="text-3xl hover:text-spotify-green"
          key={social.title}
          target="_blank"
          rel="noopener noreferrer"
          aria-label={`Visit my ${social.title} profile`}
        >
          {social.icon}
        </Link>
      ))}
    </>
  );
}

const socialMedias = [
  {
    title: "Github",
    url: "https://github.com/LuaanNguyen",
    icon: <FaGithub />,
  },
  {
    title: "Linkedin",
    url: "https://www.linkedin.com/in/luaanng",
    icon: <FaLinkedin />,
  },
  {
    title: "X",
    url: "https://x.com/luaan_ng",
    icon: <FaSquareXTwitter />,
  },
];

Type Definition

Type Definition
type socialMediasProps = {
  title: string;
  url: string;
  icon: ReactNode;
}[];
title
string
Display name of the social media platform
url
string
Full URL to the social media profile
icon
ReactNode
React icon component from react-icons/fa6

Features

Icon Library

Uses Font Awesome 6 icons from react-icons/fa6 package

Hover Effect

Icons change to Spotify green on hover with smooth transition

Accessibility

Each link has an aria-label describing the destination

Next.js Link

Uses Next.js Link component for optimized navigation

Social Platforms

The component includes links to three platforms:
  1. GitHub - Development portfolio and open source contributions
  2. LinkedIn - Professional profile and career information
  3. X (Twitter) - Social updates and professional networking

Usage

The SocialLinks component is typically used in the ProfileCard section:
Usage in ProfileCard
import SocialLinks from "../SocialLinks";

export default function ProfileCard() {
  return (
    <div>
      {/* ... other content ... */}
      <div className="flex gap-4">
        <SocialLinks />
      </div>
    </div>
  );
}

Styling

  • Icon Size: text-3xl (48px)
  • Base Color: Inherits from parent
  • Hover Color: hover:text-spotify-green (#1DB954)
  • Spacing: Applied by parent container (gap-4)

Dependencies

package.json
{
  "dependencies": {
    "react-icons": "^5.2.1"
  }
}

Customization

To add more social links, extend the socialMedias array:
Add Instagram
import { FaInstagram } from "react-icons/fa6";

const socialMedias = [
  // ... existing links
  {
    title: "Instagram",
    url: "https://instagram.com/yourhandle",
    icon: <FaInstagram />,
  },
];
The component automatically maps over the array, so adding new social platforms only requires updating the socialMedias constant.

Accessibility Best Practices

  • Each link includes target="_blank" to open in a new tab
  • rel="noopener noreferrer" prevents security vulnerabilities
  • aria-label provides screen reader context
  • key prop ensures proper React reconciliation

Build docs developers (and LLMs) love