Skip to content

Commit

Permalink
Update social media icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Dec 2, 2024
1 parent 1a3700c commit af247b6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
35 changes: 23 additions & 12 deletions components/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

import Link from "next/link";
import { usePathname } from "next/navigation";
import {
type IconType,
SiBluesky,
SiFacebook,
SiGithub,
SiInstagram,
SiLinkedin,
SiX,
} from "@icons-pack/react-simple-icons";
import {
Collapsible,
CollapsibleContent,
Expand All @@ -12,14 +21,9 @@ import {
ChevronRight,
DollarSign,
Droplet,
Facebook,
Fuel,
Gauge,
Github,
Instagram,
Linkedin,
type LucideIcon,
Twitter,
Zap,
} from "lucide-react";

Expand All @@ -43,17 +47,19 @@ import { VEHICLE_TYPE_MAP } from "@/constants";
import { slugify } from "@/utils/slugify";
import type { VehicleType } from "@/types";

type Icon = LucideIcon | IconType;

type NavItem = {
title: string;
icon?: LucideIcon;
icon?: Icon;
url: string;
isActive?: boolean;
items?: NavSubItem[];
};

type NavSubItem = {
title: string;
icon?: LucideIcon;
icon?: Icon;
url: string;
};

Expand Down Expand Up @@ -276,27 +282,32 @@ const data: Nav = {
{
title: "Facebook",
url: "https://facebook.com/sgcarstrends",
icon: Facebook,
icon: SiFacebook,
},
{
title: "Twitter",
url: "https://twitter.com/sgcarstrends",
icon: Twitter,
icon: SiX,
},
{
title: "Instagram",
url: "https://instagram.com/sgcarstrends",
icon: Instagram,
icon: SiInstagram,
},
{
title: "LinkedIn",
url: "https://linkedin.com/company/sgcarstrends",
icon: Linkedin,
icon: SiLinkedin,
},
{
title: "GitHub",
url: "https://github.com/sgcarstrends",
icon: Github,
icon: SiGithub,
},
{
title: "Bluesky",
url: "https://bsky.app/profile/sgcarstrends",
icon: SiBluesky,
},
].sort((a, b) => a.title.localeCompare(b.title)),
};
19 changes: 9 additions & 10 deletions components/NavSocialMedia.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as React from "react";
import { type LucideIcon } from "lucide-react";

import type { ComponentPropsWithoutRef } from "react";
import {
SidebarGroup,
SidebarGroupContent,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar";
import type { IconType } from "@icons-pack/react-simple-icons";

export const NavSocialMedia = ({
items,
Expand All @@ -16,18 +15,18 @@ export const NavSocialMedia = ({
items: {
title: string;
url: string;
icon?: LucideIcon;
icon?: IconType;
}[];
} & React.ComponentPropsWithoutRef<typeof SidebarGroup>) => (
} & ComponentPropsWithoutRef<typeof SidebarGroup>) => (
<SidebarGroup {...props}>
<SidebarGroupContent>
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.title}>
{items.map(({ title, url, icon: Icon }) => (
<SidebarMenuItem key={title}>
<SidebarMenuButton asChild size="sm">
<a href={item.url} target="_blank">
{item.icon && <item.icon />}
<span>{item.title}</span>
<a href={url} rel="me noreferrer" target="_blank">
{Icon && <Icon title="" />}
<span>{title}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
Expand Down

0 comments on commit af247b6

Please sign in to comment.