added title for showing the full time and date of an event on hover
This commit is contained in:
1 parent
85fcbd84fe
commit
a756ebec7a
2 files changed
+24
-2
No files matched your search
@@ -1,6 +1,12 @@
|
||||
import React, { ComponentProps } from 'react';
|
||||
import { Text, as } from 'folds';
|
||||
import { timeDayMonYear, timeHourMinute, today, yesterday } from '../../utils/time';
|
||||
import {
|
||||
timeDayMonYear,
|
||||
timeHourMinute,
|
||||
timeHourMinuteSecond,
|
||||
today,
|
||||
yesterday,
|
||||
} from '../../utils/time';
|
||||
|
||||
export type TimeProps = {
|
||||
compact?: boolean;
|
||||
@@ -36,8 +42,21 @@ export const Time = as<'span', TimeProps & ComponentProps<typeof Text>>(
|
||||
time = `${timeDayMonYear(ts, dateFormatString)} ${formattedTime}`;
|
||||
}
|
||||
|
||||
const timeTitle = `Sent ${timeDayMonYear(ts, dateFormatString)}, at ${timeHourMinuteSecond(
|
||||
ts,
|
||||
hour24Clock
|
||||
)}`;
|
||||
|
||||
return (
|
||||
<Text as="time" style={{ flexShrink: 0 }} size="T200" priority="300" {...props} ref={ref}>
|
||||
<Text
|
||||
as="time"
|
||||
style={{ flexShrink: 0 }}
|
||||
size="T200"
|
||||
priority="300"
|
||||
{...props}
|
||||
title={timeTitle}
|
||||
ref={ref}
|
||||
>
|
||||
{time}
|
||||
</Text>
|
||||
);
|
||||
|
||||
@@ -21,6 +21,9 @@ export const timeYear = (ts: number): string => dayjs(ts).format('YYYY');
|
||||
export const timeHourMinute = (ts: number, hour24Clock: boolean): string =>
|
||||
dayjs(ts).format(hour24Clock ? 'HH:mm' : 'hh:mm A');
|
||||
|
||||
export const timeHourMinuteSecond = (ts: number, hour24Clock: boolean): string =>
|
||||
dayjs(ts).format(hour24Clock ? 'HH:mm:ss' : 'hh:mm A');
|
||||
|
||||
export const timeDayMonYear = (ts: number, dateFormatString: string): string =>
|
||||
dayjs(ts).format(dateFormatString);
|
||||
|
||||
|
||||
Reference in new issue
Block a user