diff options
| author | crupest <crupest@outlook.com> | 2020-09-03 19:57:49 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2020-09-03 19:57:49 +0800 |
| commit | d8a2ca7d0ad9afdd01c654bea29b2a6c2b92ff2c (patch) | |
| tree | 05a7a1ceee83be0409ad7f9de4932e46306ef3d5 /Timeline/ClientApp/src/app/views/timeline | |
| parent | 7d70d0270b5a070b754bca8e1d740c86fd9ac48d (diff) | |
| download | timeline-d8a2ca7d0ad9afdd01c654bea29b2a6c2b92ff2c.tar.gz timeline-d8a2ca7d0ad9afdd01c654bea29b2a6c2b92ff2c.tar.bz2 timeline-d8a2ca7d0ad9afdd01c654bea29b2a6c2b92ff2c.zip | |
...
Diffstat (limited to 'Timeline/ClientApp/src/app/views/timeline')
| -rw-r--r-- | Timeline/ClientApp/src/app/views/timeline/TimelineInfoCard.tsx | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/Timeline/ClientApp/src/app/views/timeline/TimelineInfoCard.tsx b/Timeline/ClientApp/src/app/views/timeline/TimelineInfoCard.tsx index bf5c3105..9f989148 100644 --- a/Timeline/ClientApp/src/app/views/timeline/TimelineInfoCard.tsx +++ b/Timeline/ClientApp/src/app/views/timeline/TimelineInfoCard.tsx @@ -1,7 +1,6 @@ import React from "react"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; -import { fromEvent } from "rxjs"; import { Dropdown, Button } from "react-bootstrap"; import { useAvatar } from "@/services/user"; @@ -17,41 +16,19 @@ export type TimelineInfoCardProps = TimelineCardComponentProps< >; const TimelineInfoCard: React.FC<TimelineInfoCardProps> = (props) => { - const { onHeight, onMember, onManage } = props; + const { onMember, onManage } = props; const { t } = useTranslation(); const avatar = useAvatar(props.timeline.owner.username); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const containerRef = React.useRef<HTMLDivElement>(null!); - - const notifyHeight = React.useCallback((): void => { - if (onHeight) { - onHeight(containerRef.current.getBoundingClientRect().height); - } - }, [onHeight]); - - React.useEffect(() => { - const subscription = fromEvent(window, "resize").subscribe(notifyHeight); - return () => subscription.unsubscribe(); - }); - return ( - <div - ref={containerRef} - className={clsx("rounded border p-2 bg-light clearfix", props.className)} - onTransitionEnd={notifyHeight} - > + <div className={clsx("rounded border p-2 bg-light", props.className)}> <h3 className="text-primary mx-3 d-inline-block align-middle"> {props.timeline.name} </h3> <div className="d-inline-block align-middle"> - <BlobImage - blob={avatar} - onLoad={notifyHeight} - className="avatar small rounded-circle" - /> + <BlobImage blob={avatar} className="avatar small rounded-circle" /> {props.timeline.owner.nickname} <small className="ml-3 text-secondary"> @{props.timeline.owner.username} |
