Remove extra wrapper from RelativeTimestamp

This commit is contained in:
Marshall Polaris 2022-08-12 17:33:08 -07:00
parent 71d112f10e
commit dbb8057223
2 changed files with 8 additions and 6 deletions

View File

@ -11,16 +11,17 @@ dayjs.extend(advanced)
export function DateTimeTooltip(props: {
time: Dayjs
text?: string
className?: string
children?: React.ReactNode
noTap?: boolean
}) {
const { time, text, noTap } = props
const { className, time, text, noTap } = props
const formattedTime = time.format('MMM DD, YYYY hh:mm a z')
const toolTip = text ? `${text} ${formattedTime}` : formattedTime
return (
<Tooltip text={toolTip} noTap={noTap}>
<Tooltip className={className} text={toolTip} noTap={noTap}>
{props.children}
</Tooltip>
)

View File

@ -6,10 +6,11 @@ export function RelativeTimestamp(props: { time: number }) {
const { time } = props
const dayJsTime = dayjs(time)
return (
<DateTimeTooltip time={dayJsTime}>
<span className="ml-1 whitespace-nowrap text-gray-400">
{dayJsTime.fromNow()}
</span>
<DateTimeTooltip
className="ml-1 whitespace-nowrap text-gray-400"
time={dayJsTime}
>
{dayJsTime.fromNow()}
</DateTimeTooltip>
)
}