Tweaks to floating date header fading

This commit is contained in:
Evan Hahn 2022-01-28 12:31:20 -06:00 committed by GitHub
parent a34291f9dc
commit bd41bdf3cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 18 deletions

View file

@ -9,6 +9,7 @@
pointer-events: none;
position: absolute;
top: 10px;
transition: opacity 0.25s ease-out;
width: 100%;
z-index: $z-index-above-base;
@ -18,7 +19,6 @@
&--hidden {
opacity: 0;
transition: opacity 0.25s ease-out;
}
&__spinner-container {

View file

@ -501,7 +501,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
}
this.hasRecentlyScrolledTimeout = setTimeout(() => {
this.setState({ hasRecentlyScrolled: false });
}, 1000);
}, 3000);
this.updateScrollMetrics(data);
this.updateWithVisibleRows();

View file

@ -3,7 +3,7 @@
import classNames from 'classnames';
import type { CSSProperties, ReactElement } from 'react';
import React from 'react';
import React, { useEffect, useState } from 'react';
import type { LocalizerType } from '../../types/Util';
import { TimelineDateHeader } from './TimelineDateHeader';
import { Spinner } from '../Spinner';
@ -20,24 +20,34 @@ export const TimelineFloatingHeader = ({
style?: CSSProperties;
timestamp: number;
visible: boolean;
}>): ReactElement => (
<div
className={classNames(
'TimelineFloatingHeader',
`TimelineFloatingHeader--${visible ? 'visible' : 'hidden'}`
)}
style={style}
>
<TimelineDateHeader floating i18n={i18n} timestamp={timestamp} />
}>): ReactElement => {
const [hasRendered, setHasRendered] = useState(false);
useEffect(() => {
setHasRendered(true);
}, []);
return (
<div
className={classNames(
'TimelineFloatingHeader__spinner-container',
`TimelineFloatingHeader__spinner-container--${
isLoading ? 'visible' : 'hidden'
'TimelineFloatingHeader',
`TimelineFloatingHeader--${
visible && hasRendered ? 'visible' : 'hidden'
}`
)}
style={style}
>
<Spinner direction="on-background" size="20px" svgSize="small" />
<TimelineDateHeader floating i18n={i18n} timestamp={timestamp} />
<div
className={classNames(
'TimelineFloatingHeader__spinner-container',
`TimelineFloatingHeader__spinner-container--${
isLoading ? 'visible' : 'hidden'
}`
)}
>
<Spinner direction="on-background" size="20px" svgSize="small" />
</div>
</div>
</div>
);
);
};