import React from 'react';
import dayjs from 'dayjs';
import Icon from '../Icon';
import Divider from '../Divider';
import { scrollIntoView } from '../../helpers/utility';
import data from './data';
import { PageNumber, AnnotationBox, Group } from './styled';
type Props = {
type: string;
page?: number;
title?: string;
date?: string;
showPageNum?: boolean;
};
const AnnotationItem = ({
type,
title,
date,
page,
showPageNum,
}: Props): React.ReactElement => {
const handleClick = (): void => {
const ele: HTMLElement = document.getElementById(
`page_${page}`,
) as HTMLElement;
scrollIntoView(ele);
};
return (
<>
{showPageNum ? (
<>
{`Page ${page}`}
>
) : null}
{data[type].text}
{title || ''}
{date && dayjs(date?.replace('_', ' ')).format('YYYY/MM/DD HH:mm')}
>
);
};
AnnotationItem.defaultProps = {
page: 0,
title: '',
date: '',
showPageNum: false,
};
export default AnnotationItem;