diff --git a/app/components/TimeAgo.tsx b/app/components/TimeAgo.tsx new file mode 100644 index 0000000000..76e1b536bd --- /dev/null +++ b/app/components/TimeAgo.tsx @@ -0,0 +1,37 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * Copyright Oxide Computer Company + */ +import type { Placement } from '@floating-ui/react' +import { format } from 'date-fns' + +import { Tooltip } from '@oxide/ui' + +import { timeAgoAbbr } from 'app/util/date' + +export const TimeAgo = ({ + datetime, + description, + placement = 'top', +}: { + datetime: Date + description?: string + placement?: Placement +}): JSX.Element => { + const content = ( +