From d28ee05146de6a4e80d85b8fd56544111aabdd4b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Tue, 16 Jun 2020 09:43:45 +0200 Subject: [PATCH] added base date to avoid failing snapshot tests --- scm-ui/ui-components/src/Annotate.stories.tsx | 4 +++- scm-ui/ui-components/src/Annotate.tsx | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scm-ui/ui-components/src/Annotate.stories.tsx b/scm-ui/ui-components/src/Annotate.stories.tsx index aae6a2036a..cecb85ee79 100644 --- a/scm-ui/ui-components/src/Annotate.stories.tsx +++ b/scm-ui/ui-components/src/Annotate.stories.tsx @@ -112,4 +112,6 @@ const source: AnnotatedSource = { storiesOf("Annotate", module) .addDecorator(storyFn => {storyFn()}) .addDecorator(storyFn => {storyFn()}) - .add("Default", () => ); + .add("Default", () => ( + + )); diff --git a/scm-ui/ui-components/src/Annotate.tsx b/scm-ui/ui-components/src/Annotate.tsx index fd3aff56bb..490c3de82d 100644 --- a/scm-ui/ui-components/src/Annotate.tsx +++ b/scm-ui/ui-components/src/Annotate.tsx @@ -33,6 +33,7 @@ import DateShort from "./DateShort"; import { SingleContributor } from "./repos/changesets"; import DateFromNow from "./DateFromNow"; import { Link } from "react-router-dom"; +import { DateInput } from "./dates"; // TODO move types to ui-types @@ -53,6 +54,7 @@ export type AnnotatedLine = { type Props = { source: AnnotatedSource; repository: Repository; + baseDate?: DateInput; }; const LineElement = styled.div` @@ -164,11 +166,12 @@ type LineProps = { type PopoverProps = { annotation: AnnotatedLine; offsetTop?: number; - dispatch: Dispatch; repository: Repository; + baseDate?: DateInput; + dispatch: Dispatch; }; -const Popover: FC = ({ annotation, offsetTop, repository, dispatch }) => { +const Popover: FC = ({ annotation, offsetTop, repository, baseDate, dispatch }) => { const [height, setHeight] = useState(125); const ref = useRef(null); useLayoutEffect(() => { @@ -200,7 +203,7 @@ const Popover: FC = ({ annotation, offsetTop, repository, dispatch > - +

@@ -347,7 +350,7 @@ const reducer = (state: State, action: Action): State => { } }; -const Annotate: FC = ({ source, repository }) => { +const Annotate: FC = ({ source, repository, baseDate }) => { const [state, dispatch] = useReducer(reducer, initialState); const defaultRenderer = ({ rows, stylesheet, useInlineStyles }: any) => { @@ -378,7 +381,13 @@ const Annotate: FC = ({ source, repository }) => { let popover = null; if ((state.onPopover || state.onLine) && state.annotation) { popover = ( - + ); }