Skip to content

Commit

Permalink
refactor: move cn fn to utils dir
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght committed Jul 9, 2024
1 parent 7c564fe commit f659898
Show file tree
Hide file tree
Showing 30 changed files with 29 additions and 30 deletions.
3 changes: 1 addition & 2 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
"components": "@/components"
}
}
2 changes: 1 addition & 1 deletion src/components/button/VaultButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { z } from 'zod';

import { useCheckPasswordMutation } from '@/graphql/mutations/__generated__/checkPassword.generated';
import { useUserQuery } from '@/graphql/queries/__generated__/user.generated';
import { cn } from '@/lib/utils';
import { useKeyStore } from '@/stores/keys';
import { cn } from '@/utils/cn';
import { handleApolloError } from '@/utils/error';
import { WorkerMessage, WorkerResponse } from '@/workers/account/types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/button/WalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
PopoverTrigger,
} from '@/components/ui/popover';
import { useGetAllWalletsQuery } from '@/graphql/queries/__generated__/wallet.generated';
import { cn } from '@/lib/utils';
import { useChat, useContactStore } from '@/stores/contacts';
import { cn } from '@/utils/cn';
import { LOCALSTORAGE_KEYS } from '@/utils/constants';
import { ROUTES } from '@/utils/routes';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/alert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

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

const alertVariants = cva(
'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

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

const badgeVariants = cva(
'inline-flex items-center rounded-md 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/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChevronRightIcon, DotsHorizontalIcon } from '@radix-ui/react-icons';
import { Slot } from '@radix-ui/react-slot';
import * as React from 'react';

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

const Breadcrumb = React.forwardRef<
HTMLElement,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Slot } from '@radix-ui/react-slot';
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

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

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

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

const Card = React.forwardRef<
HTMLDivElement,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
import { CheckIcon } from '@radix-ui/react-icons';
import * as React from 'react';

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

const Checkbox = React.forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Command as CommandPrimitive } from 'cmdk';
import * as React from 'react';

import { Dialog, DialogContent } from '@/components/ui/dialog';
import { cn } from '@/lib/utils';
import { cn } from '@/utils/cn';

const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
import { Cross2Icon } from '@radix-ui/react-icons';
import * as React from 'react';

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

const Dialog = DialogPrimitive.Root;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import { Drawer as DrawerPrimitive } from 'vaul';

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

const Drawer = ({
shouldScaleBackground = true,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@radix-ui/react-icons';
import * as React from 'react';

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

const DropdownMenu = DropdownMenuPrimitive.Root;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'react-hook-form';

import { Label } from '@/components/ui/label';
import { cn } from '@/lib/utils';
import { cn } from '@/utils/cn';

const Form = FormProvider;

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

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

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

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

const labelVariants = cva(
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as PopoverPrimitive from '@radix-ui/react-popover';
import * as React from 'react';

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

const Popover = PopoverPrimitive.Root;

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

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

const Progress = React.forwardRef<
React.ElementRef<typeof ProgressPrimitive.Root>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import * as SelectPrimitive from '@radix-ui/react-select';
import * as React from 'react';

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

const Select = SelectPrimitive.Root;

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

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

const Separator = React.forwardRef<
React.ElementRef<typeof SeparatorPrimitive.Root>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Cross2Icon } from '@radix-ui/react-icons';
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

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

const Sheet = SheetPrimitive.Root;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cn } from '@/lib/utils';
import { cn } from '@/utils/cn';

function Skeleton({
className,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/table.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

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

const Table = React.forwardRef<
HTMLTableElement,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

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

export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as ToastPrimitives from '@radix-ui/react-toast';
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

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

const ToastProvider = ToastPrimitives.Provider;

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

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

const TooltipProvider = TooltipPrimitive.Provider;

Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet/SendAddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import {
PayLiquidAddressMutationVariables,
} from '@/graphql/mutations/__generated__/pay.generated';
import { useWalletInfo } from '@/hooks/wallet';
import { cn } from '@/lib/utils';
import { useKeyStore } from '@/stores/keys';
import { toWithError } from '@/utils/async';
import { cn } from '@/utils/cn';
import { handleApolloError } from '@/utils/error';
import { cryptoToUsd } from '@/utils/fiat';
import {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/views/contacts/Contacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
GetWalletContactsQuery,
useGetWalletContactsQuery,
} from '@/graphql/queries/__generated__/contacts.generated';
import { cn } from '@/lib/utils';
import { useContactStore } from '@/stores/contacts';
import { cn } from '@/utils/cn';
import { LOCALSTORAGE_KEYS } from '@/utils/constants';

import { AddContact } from './AddContact';
Expand Down
2 changes: 1 addition & 1 deletion src/views/contacts/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { useLocalStorage } from 'usehooks-ts';
import { Badge } from '@/components/ui/badge';
import { useToast } from '@/components/ui/use-toast';
import { useGetWalletContactMessagesQuery } from '@/graphql/queries/__generated__/contacts.generated';
import { cn } from '@/lib/utils';
import { useContactStore } from '@/stores/contacts';
import { useKeyStore } from '@/stores/keys';
import { cn } from '@/utils/cn';
import { LOCALSTORAGE_KEYS } from '@/utils/constants';
import {
CryptoWorkerMessage,
Expand Down

0 comments on commit f659898

Please sign in to comment.