From fb75ad27893d0658b9866a3386970cc5be83588e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 4 Aug 2021 16:12:58 +0200 Subject: [PATCH] Show add content button on hover or focus of content block (#876) * Show add content button on hover or focus of content block * Updating UI to make the overlay textarea to be consitent Co-authored-by: Asaad Mahmood --- .../src/components/cardDetail/cardDetail.scss | 17 +++++++++++------ webapp/src/components/cardDetail/cardDetail.tsx | 9 ++++----- .../cardDetail/cardDetailContents.tsx | 2 +- .../cardDetail/cardDetailContentsMenu.tsx | 2 +- webapp/src/components/contentBlock.scss | 3 ++- webapp/src/components/markdownEditor.scss | 8 ++++++++ 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/webapp/src/components/cardDetail/cardDetail.scss b/webapp/src/components/cardDetail/cardDetail.scss index 8faa6cf78..4f1a1d93c 100644 --- a/webapp/src/components/cardDetail/cardDetail.scss +++ b/webapp/src/components/cardDetail/cardDetail.scss @@ -55,14 +55,19 @@ } } - &.add-content { - .Button { - opacity: 0; - color: rgba(var(--body-color), 0.6); + &.content-blocks { + &:hover, &:focus-within { + .CardDetailContentsMenu { + .Button { + opacity: 1; + } + } } - &:hover { + .CardDetailContentsMenu { + margin-left: 48px; .Button { - opacity: 1; + opacity: 0; + color: rgba(var(--body-color), 0.6); } } } diff --git a/webapp/src/components/cardDetail/cardDetail.tsx b/webapp/src/components/cardDetail/cardDetail.tsx index f11490a02..bd4729246 100644 --- a/webapp/src/components/cardDetail/cardDetail.tsx +++ b/webapp/src/components/cardDetail/cardDetail.tsx @@ -139,17 +139,16 @@ const CardDetail = (props: Props): JSX.Element|null => { {/* Content blocks */} -
+
+ {!props.readonly && + + }
- - {!props.readonly && - - } ) } diff --git a/webapp/src/components/cardDetail/cardDetailContents.tsx b/webapp/src/components/cardDetail/cardDetailContents.tsx index 168cbc8fa..8e9593c9e 100644 --- a/webapp/src/components/cardDetail/cardDetailContents.tsx +++ b/webapp/src/components/cardDetail/cardDetailContents.tsx @@ -209,7 +209,7 @@ const CardDetailContents = React.memo((props: Props) => { ) } return ( -
+
{!props.readonly && diff --git a/webapp/src/components/cardDetail/cardDetailContentsMenu.tsx b/webapp/src/components/cardDetail/cardDetailContentsMenu.tsx index 4ef708433..9f7a75f09 100644 --- a/webapp/src/components/cardDetail/cardDetailContentsMenu.tsx +++ b/webapp/src/components/cardDetail/cardDetailContentsMenu.tsx @@ -55,7 +55,7 @@ type Props = { const CardDetailContentsMenu = React.memo((props: Props) => { const intl = useIntl() return ( -
+