From 6768ae2d55efd720e49aa264a8487ae4f7606c24 Mon Sep 17 00:00:00 2001 From: James Morris Date: Tue, 19 Jul 2022 13:05:42 +0100 Subject: [PATCH] First version of basic reporting modal refs https://github.com/TryGhost/Team/issues/1685 --- .../src/components/modals/GenericDialog.js | 33 +++++++++++++++++++ .../components/modals/NotAuthorContextMenu.js | 18 +++++++--- .../src/components/modals/ReportDialog.js | 17 ++++++++++ apps/comments-ui/tailwind.config.js | 8 +++++ 4 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 apps/comments-ui/src/components/modals/GenericDialog.js create mode 100644 apps/comments-ui/src/components/modals/ReportDialog.js diff --git a/apps/comments-ui/src/components/modals/GenericDialog.js b/apps/comments-ui/src/components/modals/GenericDialog.js new file mode 100644 index 0000000000..59c108b687 --- /dev/null +++ b/apps/comments-ui/src/components/modals/GenericDialog.js @@ -0,0 +1,33 @@ +import React from 'react'; +import {Transition} from '@headlessui/react'; + +const GenericDialog = (props) => { + return ( + +
+ +
+ {props.children} +
+
+
+
+ ); +}; + +export default GenericDialog; \ No newline at end of file diff --git a/apps/comments-ui/src/components/modals/NotAuthorContextMenu.js b/apps/comments-ui/src/components/modals/NotAuthorContextMenu.js index d5ff0d5223..8374083c6f 100644 --- a/apps/comments-ui/src/components/modals/NotAuthorContextMenu.js +++ b/apps/comments-ui/src/components/modals/NotAuthorContextMenu.js @@ -1,12 +1,19 @@ -import React, {useContext} from 'react'; -import AppContext from '../../AppContext'; +import React, {useState} from 'react'; +// import React, {useContext, useState} from 'react'; +import ReportDialog from './ReportDialog'; +// import AppContext from '../../AppContext'; const NotAuthorContextMenu = (props) => { - const {dispatchAction} = useContext(AppContext); + // const {dispatchAction} = useContext(AppContext); + let [isOpen, setIsOpen] = useState(false); const reportComment = (event) => { - dispatchAction('reportComment', props.comment); - props.close(); + // dispatchAction('reportComment', props.comment); + setIsOpen(true); + }; + + const closeModal = () => { + setIsOpen(false); }; return ( @@ -14,6 +21,7 @@ const NotAuthorContextMenu = (props) => { + ); }; diff --git a/apps/comments-ui/src/components/modals/ReportDialog.js b/apps/comments-ui/src/components/modals/ReportDialog.js new file mode 100644 index 0000000000..7dd09de5e9 --- /dev/null +++ b/apps/comments-ui/src/components/modals/ReportDialog.js @@ -0,0 +1,17 @@ +import React from 'react'; +import GenericDialog from './GenericDialog'; + +const ReportDialog = (props) => { + return ( + +

You sure you want to report?

+

You request will be sent to the owner of this site.

+
+ +

No,

+
+
+ ); +}; + +export default ReportDialog; \ No newline at end of file diff --git a/apps/comments-ui/tailwind.config.js b/apps/comments-ui/tailwind.config.js index 8e97c9a675..2de023e9ca 100644 --- a/apps/comments-ui/tailwind.config.js +++ b/apps/comments-ui/tailwind.config.js @@ -133,6 +133,14 @@ module.exports = { '0px 0px 1px rgba(0, 0, 0, 0.12)', '0px 13px 20px rgba(0, 0, 0, 0.04)', '0px 14px 57px rgba(0, 0, 0, 0.06)' + ], + modal: [ + '0 3.8px 2.2px rgba(0, 0, 0, 0.028)', + '0 9.2px 5.3px rgba(0, 0, 0, 0.04)', + '0 17.3px 10px rgba(0, 0, 0, 0.05)', + '0 30.8px 17.9px rgba(0, 0, 0, 0.06)', + '0 57.7px 33.4px rgba(0, 0, 0, 0.072)', + '0 138px 80px rgba(0, 0, 0, 0.1)' ] }, animation: {