import { useRef, useEffect } from 'react' import dayjs from 'dayjs' import cx from 'classnames' import { useTranslation } from 'components/hooks/useTranslation' import { useOnScreen } from 'components/hooks/useOnScreen' import { PatchNotes } from './PatchNotes' import { CurrentVersion, ReleaseNotePatch } from './types' import styles from './PatchNotes.module.scss' type Props = { patch: ReleaseNotePatch; currentVersion: CurrentVersion; didEnterView: () => void } export function GHAEReleaseNotePatch({ patch, currentVersion, 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 (

{currentVersion.versionTitle} {patch.release}

{patch.release_candidate && ( Release Candidate )}

{bannerText} {dayjs(patch.date).format('MMMM DD, YYYY')}.

) }