mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-23 21:53:05 +01:00
allow Text props in Time component
This commit is contained in:
parent
0846fc80ee
commit
2c6b4b4c52
1 changed files with 20 additions and 18 deletions
|
@ -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>
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue