Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 7x 36x 36x 36x 36x 36x | import { PropsWithChildren } from 'react'
export interface TimelineEntryContentProps extends PropsWithChildren {
type: string
position: string
topText: string
bottomText?: string
bottomDate?: string
className?: string
}
const TimelineEntryContent = ({
position,
type,
topText,
bottomText,
bottomDate,
className,
}: TimelineEntryContentProps) => {
const isCurrent = type === 'current'
const hasDate = bottomDate !== null
const isDoneWithBottom = type === 'done' && (hasDate || bottomText !== null)
const isLast = position === 'last'
return (
<div className={className}>
{isCurrent || (isDoneWithBottom && isLast) ? (
<p>
<strong>{topText}</strong>
</p>
) : (
<p>{topText}</p>
)}
{type === 'done' && hasDate ? (
<time dateTime={bottomDate}>{bottomDate}</time>
) : (
<p>{bottomText}</p>
)}
</div>
)
}
export default TimelineEntryContent
|