From 2a474aa92460a4bd3360f93f27723fb311d65454 Mon Sep 17 00:00:00 2001 From: PSkinnerTech Date: Tue, 17 Dec 2024 19:14:31 -0500 Subject: [PATCH 1/2] refactor: standardize icon types and add external link indicators --- package.json | 1 + src/components/Button.tsx | 14 +----- src/components/ExternalLink.tsx | 30 ++++++++++++ src/components/Heading.tsx | 3 +- src/components/icons/ArrowIcon.tsx | 14 ++++++ src/components/icons/BellIcon.tsx | 4 +- src/components/icons/BoltIcon.tsx | 4 +- src/components/icons/BookIcon.tsx | 4 +- src/components/icons/CalendarIcon.tsx | 4 +- src/components/icons/CartIcon.tsx | 4 +- src/components/icons/ChatBubbleIcon.tsx | 4 +- src/components/icons/CheckIcon.tsx | 4 +- src/components/icons/ChevronRightLeftIcon.tsx | 4 +- src/components/icons/ClipboardIcon.tsx | 4 +- src/components/icons/CogIcon.tsx | 4 +- src/components/icons/CopyIcon.tsx | 4 +- src/components/icons/DocumentIcon.tsx | 4 +- src/components/icons/EnvelopeIcon.tsx | 4 +- src/components/icons/FaceSmileIcon.tsx | 4 +- src/components/icons/FolderIcon.tsx | 4 +- src/components/icons/LinkIcon.tsx | 4 +- src/components/icons/ListIcon.tsx | 4 +- src/components/icons/MagnifyingGlassIcon.tsx | 4 +- src/components/icons/MapPinIcon.tsx | 4 +- src/components/icons/PackageIcon.tsx | 4 +- src/components/icons/PaperAirplaneIcon.tsx | 4 +- src/components/icons/PaperClipIcon.tsx | 4 +- src/components/icons/ShapesIcon.tsx | 4 +- src/components/icons/ShirtIcon.tsx | 4 +- src/components/icons/SquaresPlusIcon.tsx | 4 +- src/components/icons/TagIcon.tsx | 4 +- src/components/icons/UserIcon.tsx | 4 +- src/components/icons/UsersIcon.tsx | 4 +- src/components/mdx.tsx | 3 +- src/mdx/rehype.mjs | 47 +++++++++++++++++++ yarn.lock | 46 ++++++++++++++++-- 36 files changed, 223 insertions(+), 47 deletions(-) create mode 100644 src/components/ExternalLink.tsx create mode 100644 src/components/icons/ArrowIcon.tsx diff --git a/package.json b/package.json index 8b4b6bc5..0410da8f 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-highlight-words": "^0.20.0", + "rehype-external-links": "^3.0.0", "remark": "^15.0.1", "remark-gfm": "^4.0.0", "remark-mdx": "^3.0.0", diff --git a/src/components/Button.tsx b/src/components/Button.tsx index b617f1c1..040e6b71 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,18 +1,6 @@ import Link from 'next/link' import clsx from 'clsx' - -function ArrowIcon(props: React.ComponentPropsWithoutRef<'svg'>) { - return ( - - ) -} +import { ArrowIcon } from '@/components/icons/ArrowIcon' const variantStyles = { primary: diff --git a/src/components/ExternalLink.tsx b/src/components/ExternalLink.tsx new file mode 100644 index 00000000..ac4c755e --- /dev/null +++ b/src/components/ExternalLink.tsx @@ -0,0 +1,30 @@ +import Link from 'next/link' +import { SquareArrowOutUpRight } from 'lucide-react' +import clsx from 'clsx' + +function ExternalLink({ + href, + children, + className +}: { + href: string + children: React.ReactNode + className?: string +}) { + return ( + + {children} + + + ) +} + +export default ExternalLink diff --git a/src/components/Heading.tsx b/src/components/Heading.tsx index 8e2d471a..027e49c8 100644 --- a/src/components/Heading.tsx +++ b/src/components/Heading.tsx @@ -3,12 +3,13 @@ import { useEffect, useRef } from 'react' import Link from 'next/link' import { useInView } from 'framer-motion' +import { LucideProps } from 'lucide-react' import { useSectionStore } from '@/components/SectionProvider' import { Tag } from '@/components/Tag' import { remToPx } from '@/lib/remToPx' -function AnchorIcon(props: React.ComponentPropsWithoutRef<'svg'>) { +function AnchorIcon(props: LucideProps) { return ( + ) +} \ No newline at end of file diff --git a/src/components/icons/BellIcon.tsx b/src/components/icons/BellIcon.tsx index 1c0c2291..5c3fa368 100644 --- a/src/components/icons/BellIcon.tsx +++ b/src/components/icons/BellIcon.tsx @@ -1,4 +1,6 @@ -export function BellIcon(props: React.ComponentPropsWithoutRef<'svg'>) { +import { LucideProps } from 'lucide-react' + +export function BellIcon(props: LucideProps) { return (
  • {children} + {isExternal && ( + + )}
  • ) @@ -83,7 +89,7 @@ export const Header = forwardRef<