allow Text props in Time component

This commit is contained in:
Ajay Bura 2024-03-23 20:55:03 +05:30
parent 0846fc80ee
commit 2c6b4b4c52

View file

@ -1,4 +1,4 @@
import React from 'react';
import React, { ComponentProps } from 'react';
import { Text, as } from 'folds';
import { timeDayMonYear, timeHourMinute, today, yesterday } from '../../utils/time';
@ -7,7 +7,8 @@ export type TimeProps = {
ts: number;
};
export const Time = as<'span', TimeProps>(({ compact, ts, ...props }, ref) => {
export const Time = as<'span', TimeProps & ComponentProps<typeof Text>>(
({ compact, ts, ...props }, ref) => {
let time = '';
if (compact) {
time = timeHourMinute(ts);
@ -24,4 +25,5 @@ export const Time = as<'span', TimeProps>(({ compact, ts, ...props }, ref) => {
{time}
</Text>
);
});
}
);