From 9c2036a6a17534b00198a2c2eda1e46b5a6ed580 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 29 Apr 2024 15:30:40 +0200 Subject: [PATCH] fix(challenge modal): disable draggable on mobile --- .../challenge-modal.module.css | 6 + .../challenge-modal/challenge-modal.tsx | 116 ++++++++++-------- 2 files changed, 68 insertions(+), 54 deletions(-) diff --git a/src/components/challenge-modal/challenge-modal.module.css b/src/components/challenge-modal/challenge-modal.module.css index 64a25b19..e4e1af72 100644 --- a/src/components/challenge-modal/challenge-modal.module.css +++ b/src/components/challenge-modal/challenge-modal.module.css @@ -77,4 +77,10 @@ cursor: pointer; filter: var(--filter80); text-transform: capitalize; +} + +@media (max-width: 640px) { + .title { + cursor: default; + } } \ No newline at end of file diff --git a/src/components/challenge-modal/challenge-modal.tsx b/src/components/challenge-modal/challenge-modal.tsx index ea8c2f33..09461170 100644 --- a/src/components/challenge-modal/challenge-modal.tsx +++ b/src/components/challenge-modal/challenge-modal.tsx @@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'; import { Challenge as ChallengeType } from '@plebbit/plebbit-react-hooks'; import { getPublicationType } from '../../lib/utils/challenge-utils'; import useChallenges from '../../hooks/use-challenges'; +import useWindowWidth from '../../hooks/use-window-width'; import styles from './challenge-modal.module.css'; import _ from 'lodash'; @@ -53,67 +54,74 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => { // react-draggable requires a ref to the modal node const nodeRef = useRef(null); + const isMobile = useWindowWidth() < 640; - return ( - -
-
- Challenge for {publicationType} -
+
+
+
-
-
- + {title && ( +
+
- {title && ( -
- -
- )} - {content && ( -
-