From f918ac9cecae3b6a1b28cdbb2a2568aaf77d9e17 Mon Sep 17 00:00:00 2001 From: Konrad Ryczko Date: Wed, 6 Sep 2023 20:44:09 +0200 Subject: [PATCH] Fix/Coping URL --- .../ShareSurveryModal/ShareSurveyModal.tsx | 24 ++++--------------- .../components/StyledDialog/StyledDialog.tsx | 4 ++-- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/features/surveys/components/ShareSurveryModal/ShareSurveyModal.tsx b/src/features/surveys/components/ShareSurveryModal/ShareSurveyModal.tsx index e8f27be1..82a4dd52 100644 --- a/src/features/surveys/components/ShareSurveryModal/ShareSurveyModal.tsx +++ b/src/features/surveys/components/ShareSurveryModal/ShareSurveyModal.tsx @@ -1,5 +1,5 @@ import { LinkIcon } from '@heroicons/react/outline'; -import React, { useCallback, useRef } from 'react'; +import React from 'react'; import Button, { ButtonVariant } from 'shared/components/Button/Button'; import StyledDialog from 'shared/components/StyledDialog/StyledDialog'; import useTranslation from 'next-translate/useTranslation'; @@ -18,40 +18,24 @@ export default function ShareSurveyModal({ }: ShareSurveyModalProps) { const { t } = useTranslation('common'); const { copy } = useCopyToClipboard(); - const inputEl = useRef(null); const link = `${window.location.protocol}//${window.location.host}/survey/${surveyId}`; const handleCopy = () => { copy(link); - - if (inputEl.current) { - inputEl.current.select(); - } }; - const handleInputFocus = useCallback( - (e: React.FocusEvent) => { - e.target.select(); - }, - [] - ); - return (
- + + {link} +
diff --git a/src/shared/components/StyledDialog/StyledDialog.tsx b/src/shared/components/StyledDialog/StyledDialog.tsx index a74b7b5e..57c132e1 100644 --- a/src/shared/components/StyledDialog/StyledDialog.tsx +++ b/src/shared/components/StyledDialog/StyledDialog.tsx @@ -17,7 +17,7 @@ export default function StyledDialog({ isOpen, onClose, contentClassName = '', - centerTitle = false, + centerTitle = true, }: StyledDialogProps) { return ( @@ -47,7 +47,7 @@ export default function StyledDialog({ >