From fb7aecd5e1ed38c4d61b29d9a42dfaffae4c481d Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Fri, 17 Dec 2021 14:05:40 +0100 Subject: [PATCH] Revert popover changes --- scm-ui/ui-components/src/popover/Popover.tsx | 19 ++++++++++ .../src/repos/annotate/Annotate.tsx | 4 +-- .../{Popover.tsx => AnnotatePopover.tsx} | 35 ++++++++++++++++--- scm-ui/ui-styles/src/components/_main.scss | 24 ------------- 4 files changed, 51 insertions(+), 31 deletions(-) rename scm-ui/ui-components/src/repos/annotate/{Popover.tsx => AnnotatePopover.tsx} (81%) diff --git a/scm-ui/ui-components/src/popover/Popover.tsx b/scm-ui/ui-components/src/popover/Popover.tsx index d89205688c..5668e7eb6b 100644 --- a/scm-ui/ui-components/src/popover/Popover.tsx +++ b/scm-ui/ui-components/src/popover/Popover.tsx @@ -41,10 +41,29 @@ type ContainerProps = { }; const PopoverContainer = styled.div` + position: absolute; + z-index: 100; width: ${props => props.width}px; + display: block; &:before { + position: absolute; + content: ""; + border-style: solid; + pointer-events: none; + height: 0; + width: 0; + top: 100%; left: ${props => props.width / 2}px; + border-color: transparent; + border-bottom-color: white; + border-left-color: white; + border-width: 0.4rem; + margin-left: -0.4rem; + margin-top: -0.4rem; + -webkit-transform-origin: center; + transform-origin: center; + transform: rotate(-45deg); } `; diff --git a/scm-ui/ui-components/src/repos/annotate/Annotate.tsx b/scm-ui/ui-components/src/repos/annotate/Annotate.tsx index 0236ab0463..657ea34057 100644 --- a/scm-ui/ui-components/src/repos/annotate/Annotate.tsx +++ b/scm-ui/ui-components/src/repos/annotate/Annotate.tsx @@ -32,7 +32,7 @@ import { PrismAsyncLight as ReactSyntaxHighlighter, createElement } from "react- // eslint-disable-next-line no-restricted-imports import highlightingTheme from "../../syntax-highlighting"; import { DateInput } from "../../useDateFormatter"; -import Popover from "./Popover"; +import AnnotatePopover from "./AnnotatePopover"; import AnnotateLine from "./AnnotateLine"; import { Action } from "./actions"; import { determineLanguage } from "../../languages"; @@ -128,7 +128,7 @@ const Annotate: FC = ({ source, repository, baseDate }) => { let popover = null; if ((state.onPopover || state.onLine) && state.annotation) { popover = ( - ; }; -const Popover: FC = ({ annotation, offsetTop, repository, baseDate, dispatch }) => { +const AnnotatePopover: FC = ({ annotation, offsetTop, repository, baseDate, dispatch }) => { const [t] = useTranslation("repos"); const [height, setHeight] = useState(125); const ref = useRef(null); @@ -72,13 +97,13 @@ const Popover: FC = ({ annotation, offsetTop, repository, baseDate const onMouseEnter = () => { dispatch({ - type: "enter-popover" + type: "enter-popover", }); }; const OnMouseLeave = () => { dispatch({ - type: "leave-popover" + type: "leave-popover", }); }; @@ -88,7 +113,7 @@ const Popover: FC = ({ annotation, offsetTop, repository, baseDate ref={ref} onMouseEnter={onMouseEnter} onMouseLeave={OnMouseLeave} - className="box popover" + className="box" style={{ top: `${top}px` }} > @@ -110,4 +135,4 @@ const Popover: FC = ({ annotation, offsetTop, repository, baseDate ); }; -export default Popover; +export default AnnotatePopover; diff --git a/scm-ui/ui-styles/src/components/_main.scss b/scm-ui/ui-styles/src/components/_main.scss index 95816e8025..df79ab3400 100644 --- a/scm-ui/ui-styles/src/components/_main.scss +++ b/scm-ui/ui-styles/src/components/_main.scss @@ -343,30 +343,6 @@ footer.footer { } } -.popover { - position: absolute; - z-index: 100; - width: 30em; - display: block; - - &:before { - position: absolute; - content: ""; - border-style: solid; - pointer-events: none; - height: 0; - width: 0; - top: 100%; - left: 5.5em; - border-color: transparent; - border-width: 0.4rem; - margin-left: -0.4rem; - margin-top: -0.4rem; - -webkit-transform-origin: center; - transform-origin: center; - transform: rotate(-45deg); - } -} .notifications .dropdown-menu:before { border: 0.4rem solid transparent;