UI: refactor icon import

This commit is contained in:
Fuma Nama
2025-12-14 15:39:36 +08:00
parent 33fe51dbea
commit 2155a83bd0
26 changed files with 35 additions and 39 deletions
+1 -1
View File
@@ -416,7 +416,7 @@ export const registry: Registry = {
dependencies: {
'fumadocs-core': null,
'fumadocs-ui': null,
'lucide-react': null,
'@icons': null,
react: null,
},
};
+1 -1
View File
@@ -5,7 +5,7 @@ import type {
AccordionSingleProps,
} from '@radix-ui/react-accordion';
import * as AccordionPrimitive from '@radix-ui/react-accordion';
import { Check, ChevronRight, Link as LinkIcon } from 'lucide-react';
import { Check, ChevronRight, Link as LinkIcon } from '@icons';
import {
type ComponentPropsWithoutRef,
forwardRef,
+1 -1
View File
@@ -1,7 +1,7 @@
'use client';
import { type HTMLAttributes, useEffect, useState } from 'react';
import { X } from 'lucide-react';
import { X } from '@icons';
import { cn } from '@/utils/cn';
import { buttonVariants } from '@/components/ui/button';
+1 -1
View File
@@ -1,4 +1,4 @@
import { CircleCheck, CircleX, Info, TriangleAlert, Sun } from 'lucide-react';
import { CircleCheck, CircleX, Info, Sun, TriangleAlert } from '@icons';
import type { ComponentProps, ReactNode } from 'react';
import { cn } from '@/utils/cn';
+1 -1
View File
@@ -1,5 +1,5 @@
'use client';
import { Check, Clipboard } from 'lucide-react';
import { Check, Clipboard } from '@icons';
import {
type ComponentProps,
createContext,
+1 -1
View File
@@ -1,6 +1,6 @@
'use client';
import { ChevronRight, Hash, Search as SearchIcon } from 'lucide-react';
import { ChevronRight, Hash, Search as SearchIcon } from '@icons';
import {
type ComponentProps,
createContext,
+1 -5
View File
@@ -1,11 +1,7 @@
'use client';
import { cva } from 'class-variance-authority';
import {
File as FileIcon,
Folder as FolderIcon,
FolderOpen,
} from 'lucide-react';
import { File as FileIcon, Folder as FolderIcon, FolderOpen } from '@icons';
import { type HTMLAttributes, type ReactNode, useState } from 'react';
import { cn } from '@/utils/cn';
import {
+1 -1
View File
@@ -1,5 +1,5 @@
import { cn } from '@/utils/cn';
import { Star } from 'lucide-react';
import { Star } from '@icons';
import { type AnchorHTMLAttributes } from 'react';
async function getRepoStarsAndForks(
+1 -1
View File
@@ -1,4 +1,4 @@
import { Link } from 'lucide-react';
import { Link } from '@icons';
import type { ComponentPropsWithoutRef } from 'react';
import { cn } from '@/utils/cn';
+1 -1
View File
@@ -1,6 +1,6 @@
'use client';
import { ChevronDown } from 'lucide-react';
import { ChevronDown } from '@icons';
import type { TOCItemType } from 'fumadocs-core/toc';
import {
Collapsible,
+1 -1
View File
@@ -1,5 +1,5 @@
'use client';
import { ChevronDown, ExternalLink } from 'lucide-react';
import { ChevronDown, ExternalLink } from '@icons';
import {
type ComponentProps,
createContext,
@@ -1,5 +1,5 @@
'use client';
import { Check, ChevronsUpDown } from 'lucide-react';
import { Check, ChevronsUpDown } from '@icons';
import { type ComponentProps, type ReactNode, useMemo, useState } from 'react';
import Link from 'fumadocs-core/link';
import { usePathname } from 'fumadocs-core/framework';
+1 -1
View File
@@ -1,6 +1,6 @@
'use client';
import { ChevronDown } from 'lucide-react';
import { ChevronDown } from '@icons';
import Link from 'fumadocs-core/link';
import { cva } from 'class-variance-authority';
import { cn } from '@/utils/cn';
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* @license lucide-react - ISC
* @license @icons - ISC
*
* All copyright belongs to https://github.com/lucide-icons/lucide, we bundle it as part of library to avoid upstream issues.
*/
+3 -3
View File
@@ -5,7 +5,7 @@ import {
type ReactNode,
useMemo,
} from 'react';
import { Languages, Sidebar as SidebarIcon } from 'lucide-react';
import { Languages, Sidebar as SidebarIcon } from '@icons';
import { cn } from '@/utils/cn';
import { buttonVariants } from '@/components/ui/button';
import {
@@ -25,10 +25,10 @@ import {
LanguageToggleText,
} from '@/layouts/shared/language-toggle';
import {
LayoutTabs,
LayoutHeader,
LayoutBody,
LayoutContextProvider,
LayoutHeader,
LayoutTabs,
} from './client';
import { TreeContextProvider } from '@/contexts/tree';
import { ThemeToggle } from '../shared/theme-toggle';
+3 -3
View File
@@ -2,16 +2,16 @@
import {
type ComponentProps,
createContext,
Fragment,
use,
useEffect,
useEffectEvent,
createContext,
useMemo,
useRef,
useState,
use,
} from 'react';
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';
import { ChevronDown, ChevronLeft, ChevronRight } from '@icons';
import Link from 'fumadocs-core/link';
import { cn } from '@/utils/cn';
import { useI18n } from '@/contexts/i18n';
+1 -1
View File
@@ -1,7 +1,7 @@
import type { ComponentProps, ReactNode } from 'react';
import { cn } from '@/utils/cn';
import { buttonVariants } from '@/components/ui/button';
import { Edit, Text } from 'lucide-react';
import { Edit, Text } from '@icons';
import { I18nLabel } from '@/contexts/i18n';
import {
type BreadcrumbProps,
+1 -1
View File
@@ -7,7 +7,7 @@ import { createPageTreeRenderer } from '@/components/sidebar/page-tree';
import { createLinkItemRenderer } from '@/components/sidebar/link-item';
import { buttonVariants } from '@/components/ui/button';
import { SearchToggle } from '@/layouts/shared/search-toggle';
import { Sidebar as SidebarIcon } from 'lucide-react';
import { Sidebar as SidebarIcon } from '@icons';
import { mergeRefs } from '@/utils/merge-refs';
const itemVariants = cva(
+2 -2
View File
@@ -4,9 +4,9 @@ import { cva } from 'class-variance-authority';
import Link from 'fumadocs-core/link';
import { cn } from '@/utils/cn';
import {
type LinkItemType,
type NavOptions,
resolveLinkItems,
type LinkItemType,
} from '@/layouts/shared';
import { LinkItem } from '@/layouts/shared/link-item';
import {
@@ -29,7 +29,7 @@ import {
LanguageToggle,
LanguageToggleText,
} from '@/layouts/shared/language-toggle';
import { ChevronDown, Languages } from 'lucide-react';
import { ChevronDown, Languages } from '@icons';
import { useIsScrollTop } from '@/utils/use-is-scroll-top';
export const navItemVariants = cva('[&_svg]:size-4', {
+2 -2
View File
@@ -13,15 +13,15 @@ import {
useState,
} from 'react';
import { useSidebar } from '@/components/sidebar/base';
import { ChevronDown } from 'lucide-react';
import { ChevronDown } from '@icons';
import Link from 'fumadocs-core/link';
import { usePathname } from 'fumadocs-core/framework';
import { isTabActive } from '@/utils/is-active';
import { useIsScrollTop } from '@/utils/use-is-scroll-top';
import {
LinkItem,
type MenuItemType,
type LinkItemType,
type MenuItemType,
} from '../shared/link-item';
import {
Popover,
+2 -2
View File
@@ -19,15 +19,15 @@ import {
import { TreeContextProvider } from '@/contexts/tree';
import { cn } from '@/utils/cn';
import { buttonVariants } from '@/components/ui/button';
import { Languages, Sidebar as SidebarIcon, X } from 'lucide-react';
import { Languages, Sidebar as SidebarIcon, X } from '@icons';
import { LanguageToggle } from '@/layouts/shared/language-toggle';
import { ThemeToggle } from '@/layouts/shared/theme-toggle';
import type * as PageTree from 'fumadocs-core/page-tree';
import {
LayoutBody,
LayoutContextProvider,
LayoutHeaderTabs,
LayoutHeader,
LayoutHeaderTabs,
NavbarLinkItem,
} from '@/layouts/notebook/client';
import Link from 'fumadocs-core/link';
@@ -2,16 +2,16 @@
import {
type ComponentProps,
createContext,
Fragment,
use,
useEffect,
useEffectEvent,
createContext,
useMemo,
useRef,
useState,
use,
} from 'react';
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';
import { ChevronDown, ChevronLeft, ChevronRight } from '@icons';
import Link from 'fumadocs-core/link';
import { cn } from '@/utils/cn';
import { useI18n } from '@/contexts/i18n';
@@ -1,7 +1,7 @@
import type { ComponentProps, ReactNode } from 'react';
import { cn } from '@/utils/cn';
import { buttonVariants } from '@/components/ui/button';
import { Edit, Text } from 'lucide-react';
import { Edit, Text } from '@icons';
import { I18nLabel } from '@/contexts/i18n';
import {
type BreadcrumbProps,
@@ -1,6 +1,6 @@
'use client';
import type { ComponentProps } from 'react';
import { Search } from 'lucide-react';
import { Search } from '@icons';
import { useSearchContext } from '@/contexts/search';
import { useI18n } from '@/contexts/i18n';
import { cn } from '@/utils/cn';
@@ -1,6 +1,6 @@
'use client';
import { cva } from 'class-variance-authority';
import { Moon, Sun, Airplay } from 'lucide-react';
import { Airplay, Moon, Sun } from '@icons';
import { useTheme } from 'next-themes';
import { ComponentProps, useEffect, useState } from 'react';
import { cn } from '@/utils/cn';
+1 -1
View File
@@ -3,7 +3,7 @@
"compilerOptions": {
"paths": {
"@/*": ["./src/*"],
"lucide-react": ["./src/icons"]
"@icons": ["./src/icons"]
}
},
"tsc-alias": {