mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
drop some types in
This commit is contained in:
@@ -1,18 +1,30 @@
|
||||
import React from 'react'
|
||||
import { ILatest } from '../interfaces/ILatest'
|
||||
import Button from './Button'
|
||||
|
||||
export default function (props) {
|
||||
const latest = props.latest || []
|
||||
export default function LatestList({
|
||||
latest,
|
||||
onSelect,
|
||||
onRemove,
|
||||
}: {
|
||||
latest: ILatest[]
|
||||
onSelect: (l: ILatest) => void
|
||||
onRemove: (l: ILatest) => void
|
||||
}) {
|
||||
if (!latest || !latest.length) {
|
||||
return null
|
||||
}
|
||||
const latestElements = latest.map((item) => {
|
||||
const created = new Date(item.created)
|
||||
const subject = item.subject
|
||||
const hrefId = `#item-${item.id}`
|
||||
return (
|
||||
<li key={item.id}>
|
||||
<a href={hrefId} onClick={() => props.onSelect(item)}>
|
||||
{created.toLocaleString()}
|
||||
<a href={hrefId} onClick={() => onSelect(item)}>
|
||||
<div>{subject}</div>
|
||||
<div>{created.toLocaleDateString()}</div>
|
||||
</a>
|
||||
<span> </span>
|
||||
<Button onClick={() => props.onRemove(item)}>Remove</Button>
|
||||
<Button onClick={() => onRemove(item)}>Remove</Button>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user