Skip to content

Commit

Permalink
refactor: 💡 统一从utils导入 (#71)
Browse files Browse the repository at this point in the history
* refactor: 💡 统一从utils导入

* feat: test

* feat: remove useless file
  • Loading branch information
coderz-w authored Jul 19, 2024
1 parent d85b317 commit 8033526
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/app/edit/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
useSplitStore,
} from '@/store/editorStore';
import { useDragIconStore } from '@/store/dragIconStore';
import { addNewModel } from '@/components/editor/utils';
import { addNewModel } from '@/utils';

const MockUserInfo = {
name: 'xiaoming',
Expand Down
12 changes: 6 additions & 6 deletions src/components/avatarPopover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
AiOutlinePoweroff,
} from 'react-icons/ai';

import { Avatar } from '../common/Avatar';
import { Menu, MenuItem } from './menu/index';
import { Avatar } from '@/components/common/Avatar';
import { Menu, MenuItem } from '@/components/avatarPopover/menu';

const AvatarPopoverContent: FC = () => {
const menuItemTwStyle = `flex items-center`;
Expand Down Expand Up @@ -54,9 +54,9 @@ const AvatarPopoverContent: FC = () => {

const AvatarPopover: FC<{ children: ReactNode }> = ({ children }) => {
const twAnimation = `
data-[state=open]:data-[side=top]:animate-slideDownAndFade
data-[state=open]:data-[side=right]:animate-slideLeftAndFade
data-[state=open]:data-[side=bottom]:animate-slideUpAndFade
data-[state=open]:data-[side=top]:animate-slideDownAndFade
data-[state=open]:data-[side=right]:animate-slideLeftAndFade
data-[state=open]:data-[side=bottom]:animate-slideUpAndFade
data-[state=open]:data-[side=left]:animate-slideRightAndFade
`;
const twShadow = `
Expand All @@ -70,7 +70,7 @@ const AvatarPopover: FC<{ children: ReactNode }> = ({ children }) => {
{children}
</PopoverTrigger>
<PopoverContent
className={`rounded w-[260px] bg-slate-900
className={`rounded w-[260px] bg-slate-900
will-change-[transform,opacity] ${twAnimation} ${twShadow}`}
sideOffset={5}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/extension/tree-view-api/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { RiDeleteBin6Line } from 'react-icons/ri';

import { Button } from '@/components/ui/button';
import { ScrollArea } from '@/components/ui/scroll-area';
import { cn } from '@/utils/cn';
import { cn } from '@/utils';
import { useUploadFileDataStore } from '@/store/uploadFileDataStore';

type TreeViewElement = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/file/fileItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@/store/editorStore';
import { useDragIconStore } from '@/store/dragIconStore';
import { useUploadFileDataStore } from '@/store/uploadFileDataStore';
import { addNewModel } from '@/components/editor/utils';
import { addNewModel } from '@/utils';
interface FileItemProps {
file: any;
onMouseupFn?: () => void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/create-project-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useRouter } from 'next/navigation';
import { AiOutlineLoading3Quarters } from 'react-icons/ai';

import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { getDirectory } from '@/utils/getLocalDirectory';
import { getDirectory } from '@/utils';
import { useModal } from '@/hooks/useModal';
import { useUploadFileDataStore } from '@/store/uploadFileDataStore';

Expand Down
2 changes: 1 addition & 1 deletion src/components/resize-handle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { PanelResizeHandle } from 'react-resizable-panels';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

interface ResizeHandleType {
direction?: 'vertical' | 'horizontal';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import * as AvatarPrimitive from '@radix-ui/react-avatar';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

type AvatarProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>;
type AvatarImageProps = React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/badge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

const badgeVariants = cva(
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Slot } from '@radix-ui/react-slot';
import { cva, type VariantProps } from 'class-variance-authority';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

const buttonVariants = cva(
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { Cross2Icon } from '@radix-ui/react-icons';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dropdown-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
import { Check, ChevronRight, Circle } from 'lucide-react';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

const DropdownMenu = DropdownMenuPrimitive.Root;
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/scroll-area/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';

import { cn } from '@/utils/cn';
import { cn } from '@/utils';

const ScrollArea = React.forwardRef<
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './cn';
export * from './constants';
export * from './editor';
export * from './getLocalDirectory';

0 comments on commit 8033526

Please sign in to comment.