import { useRef, useEffect } from 'react' import { useTranslation } from 'components/hooks/useTranslation' import { useOnScreen } from 'components/hooks/useOnScreen' import { PatchNotes } from './PatchNotes' import { ReleaseNotePatch } from './types' type Props = { patch: ReleaseNotePatch; didEnterView: () => void } export function GHAEReleaseNotePatch({ patch, didEnterView }: Props) { const { t } = useTranslation('release_notes') const containerRef = useRef(null) const onScreen = useOnScreen(containerRef, { rootMargin: '-40% 0px -50%' }) useEffect(() => { if (onScreen) { didEnterView() } }, [onScreen]) const bannerText = t('banner_text') return (

{patch.title}

{patch.release_candidate && ( Release Candidate )}

{bannerText} {patch.friendlyDate}.

) }