aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-14 17:35:34 +0800
committercrupest <crupest@outlook.com>2021-02-14 17:35:34 +0800
commit80f5bf676ac5c8d466284ffa1aa6de0208c94164 (patch)
tree097e0f7b7e63e36b2f846ed3168feb6532315682
parent3f6dbd2bd0fc8c9439733c88f6c169ed28c2def7 (diff)
downloadtimeline-80f5bf676ac5c8d466284ffa1aa6de0208c94164.tar.gz
timeline-80f5bf676ac5c8d466284ffa1aa6de0208c94164.tar.bz2
timeline-80f5bf676ac5c8d466284ffa1aa6de0208c94164.zip
feat: Timeline top is back.
-rw-r--r--FrontEnd/src/app/views/timeline-common/Timeline.tsx3
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx1
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePostListView.tsx5
3 files changed, 8 insertions, 1 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
index 07ca2924..d40f8e94 100644
--- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx
+++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
@@ -12,6 +12,7 @@ import TimelinePostListView from "./TimelinePostListView";
export interface TimelineProps {
className?: string;
style?: React.CSSProperties;
+ top?: string | number;
timelineName: string;
reloadKey: number;
onReload: () => void;
@@ -24,6 +25,7 @@ const Timeline: React.FC<TimelineProps> = (props) => {
timelineName,
className,
style,
+ top,
reloadKey,
onReload,
additionalPosts,
@@ -110,6 +112,7 @@ const Timeline: React.FC<TimelineProps> = (props) => {
return (
<TimelinePostListView
posts={[...posts, ...(additionalPosts ?? [])]}
+ top={top}
onReload={onReload}
/>
);
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx
index 7fcf2d52..7319d84d 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx
@@ -136,6 +136,7 @@ export default function TimelinePageTemplateUI<TManageItems>(
}}
>
<Timeline
+ top={40}
timelineName={timeline.name}
reloadKey={timelineReloadKey}
onReload={reloadTimeline}
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostListView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostListView.tsx
index 961b4667..fe12b806 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePostListView.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePostListView.tsx
@@ -5,6 +5,7 @@ import { HttpTimelinePostInfo } from "@/http/timeline";
import TimelinePostView from "./TimelinePostView";
import TimelineDateLabel from "./TimelineDateLabel";
+import TimelineTop from "./TimelineTop";
function dateEqual(left: Date, right: Date): boolean {
return (
@@ -17,12 +18,13 @@ function dateEqual(left: Date, right: Date): boolean {
export interface TimelinePostListViewProps {
className?: string;
style?: React.CSSProperties;
+ top?: string | number;
posts: HttpTimelinePostInfo[];
onReload: () => void;
}
const TimelinePostListView: React.FC<TimelinePostListViewProps> = (props) => {
- const { className, style, posts, onReload } = props;
+ const { className, style, top, posts, onReload } = props;
const groupedPosts = React.useMemo<
{ date: Date; posts: (HttpTimelinePostInfo & { index: number })[] }[]
@@ -51,6 +53,7 @@ const TimelinePostListView: React.FC<TimelinePostListViewProps> = (props) => {
return (
<div style={style} className={clsx("timeline", className)}>
+ {top && <TimelineTop height={top} />}
{groupedPosts.map((group) => {
return (
<Fragment key={group.date.toDateString()}>