import { CollectionSort, SortableItem } from '@standardnotes/snjs' import { FunctionComponent } from 'preact' import { ListableContentItem } from './Types/ListableContentItem' type Props = { item: { protected: ListableContentItem['protected'] updatedAtString?: ListableContentItem['updatedAtString'] createdAtString?: ListableContentItem['createdAtString'] } hideDate: boolean sortBy: keyof SortableItem | undefined } export const ListItemMetadata: FunctionComponent = ({ item, hideDate, sortBy }) => { const showModifiedDate = sortBy === CollectionSort.UpdatedAt if (hideDate && !item.protected) { return null } return (
{item.protected && Protected {hideDate ? '' : ' • '}} {!hideDate && showModifiedDate && Modified {item.updatedAtString || 'Now'}} {!hideDate && !showModifiedDate && {item.createdAtString || 'Now'}}
) }