From e4c5ec974ddd5b4785dc5857c9b2a8abca1e2dc3 Mon Sep 17 00:00:00 2001 From: Tomas Date: Fri, 16 Aug 2024 11:29:04 +0200 Subject: [PATCH] Move useForwardedRef to new package --- frontend/dashboard/components/MakeCopyModal/MakeCopyModal.tsx | 3 ++- .../StudioModal/StudioModalDialog/StudioModalDialog.tsx | 2 +- frontend/libs/studio-components/src/hooks/index.ts | 1 - frontend/libs/studio-hooks/src/hooks/index.ts | 1 + .../src/hooks/useForwardedRef.test.tsx | 0 .../src/hooks/useForwardedRef.ts | 0 .../LocalChangesModal/DeleteModal/DeleteModal.tsx | 3 ++- 7 files changed, 6 insertions(+), 4 deletions(-) rename frontend/libs/{studio-components => studio-hooks}/src/hooks/useForwardedRef.test.tsx (100%) rename frontend/libs/{studio-components => studio-hooks}/src/hooks/useForwardedRef.ts (100%) diff --git a/frontend/dashboard/components/MakeCopyModal/MakeCopyModal.tsx b/frontend/dashboard/components/MakeCopyModal/MakeCopyModal.tsx index 025c54e846f..2bfe88fb386 100644 --- a/frontend/dashboard/components/MakeCopyModal/MakeCopyModal.tsx +++ b/frontend/dashboard/components/MakeCopyModal/MakeCopyModal.tsx @@ -1,5 +1,6 @@ import React, { forwardRef, useState } from 'react'; -import { StudioModal, useForwardedRef } from '@studio/components'; +import { StudioModal } from '@studio/components'; +import { useForwardedRef } from '@studio/hooks'; import { useTranslation } from 'react-i18next'; import { useCopyAppMutation } from 'dashboard/hooks/mutations/useCopyAppMutation'; import type { AxiosError } from 'axios'; diff --git a/frontend/libs/studio-components/src/components/StudioModal/StudioModalDialog/StudioModalDialog.tsx b/frontend/libs/studio-components/src/components/StudioModal/StudioModalDialog/StudioModalDialog.tsx index cae584196c7..ea9032d0411 100644 --- a/frontend/libs/studio-components/src/components/StudioModal/StudioModalDialog/StudioModalDialog.tsx +++ b/frontend/libs/studio-components/src/components/StudioModal/StudioModalDialog/StudioModalDialog.tsx @@ -4,7 +4,7 @@ import { Modal } from '@digdir/designsystemet-react'; import type { ModalDialogProps } from '@digdir/designsystemet-react'; import cn from 'classnames'; import classes from './StudioModalDialog.module.css'; -import { useForwardedRef } from '../../../hooks'; +import { useForwardedRef } from '@studio/hooks'; export type StudioModalDialogProps = ModalDialogProps & { children: ReactNode; diff --git a/frontend/libs/studio-components/src/hooks/index.ts b/frontend/libs/studio-components/src/hooks/index.ts index efbc39b46aa..9fe8877acde 100644 --- a/frontend/libs/studio-components/src/hooks/index.ts +++ b/frontend/libs/studio-components/src/hooks/index.ts @@ -1,4 +1,3 @@ -export * from './useForwardedRef'; export * from './useLocalStorage'; export * from './useMediaQuery'; export * from './usePrevious'; diff --git a/frontend/libs/studio-hooks/src/hooks/index.ts b/frontend/libs/studio-hooks/src/hooks/index.ts index 4e3b90cca5d..3ef1d948b58 100644 --- a/frontend/libs/studio-hooks/src/hooks/index.ts +++ b/frontend/libs/studio-hooks/src/hooks/index.ts @@ -1,2 +1,3 @@ export * from './useDebounce'; +export * from './useForwardedRef'; export * from './useUniqueKeys'; diff --git a/frontend/libs/studio-components/src/hooks/useForwardedRef.test.tsx b/frontend/libs/studio-hooks/src/hooks/useForwardedRef.test.tsx similarity index 100% rename from frontend/libs/studio-components/src/hooks/useForwardedRef.test.tsx rename to frontend/libs/studio-hooks/src/hooks/useForwardedRef.test.tsx diff --git a/frontend/libs/studio-components/src/hooks/useForwardedRef.ts b/frontend/libs/studio-hooks/src/hooks/useForwardedRef.ts similarity index 100% rename from frontend/libs/studio-components/src/hooks/useForwardedRef.ts rename to frontend/libs/studio-hooks/src/hooks/useForwardedRef.ts diff --git a/frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx b/frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx index aff615bcbcb..fe35114c456 100644 --- a/frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx +++ b/frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx @@ -1,7 +1,8 @@ import React, { forwardRef, useState } from 'react'; import classes from './DeleteModal.module.css'; import { useTranslation } from 'react-i18next'; -import { StudioButton, StudioModal, StudioSpinner, useForwardedRef } from '@studio/components'; +import { StudioButton, StudioModal, StudioSpinner } from '@studio/components'; +import { useForwardedRef } from '@studio/hooks'; import { TrashIcon } from '@studio/icons'; import { useResetRepositoryMutation } from 'app-development/hooks/mutations/useResetRepositoryMutation'; import { toast } from 'react-toastify';