mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
inherit font weight for time component
This commit is contained in:
parent
d36938e1fd
commit
67c6785bf3
2 changed files with 17 additions and 2 deletions
6
src/app/components/message/Time.css.ts
Normal file
6
src/app/components/message/Time.css.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { style } from '@vanilla-extract/css';
|
||||
|
||||
export const Time = style({
|
||||
fontWeight: 'inherit',
|
||||
flexShrink: 0,
|
||||
});
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
import React, { ComponentProps } from 'react';
|
||||
import { Text, as } from 'folds';
|
||||
import classNames from 'classnames';
|
||||
import { timeDayMonYear, timeHourMinute, today, yesterday } from '../../utils/time';
|
||||
import * as css from './Time.css';
|
||||
|
||||
export type TimeProps = {
|
||||
compact?: boolean;
|
||||
|
|
@ -22,7 +24,7 @@ export type TimeProps = {
|
|||
* @returns {React.ReactElement} A <Text as="time"> element with the formatted date/time.
|
||||
*/
|
||||
export const Time = as<'span', TimeProps & ComponentProps<typeof Text>>(
|
||||
({ compact, hour24Clock, dateFormatString, ts, ...props }, ref) => {
|
||||
({ compact, hour24Clock, dateFormatString, ts, className, ...props }, ref) => {
|
||||
const formattedTime = timeHourMinute(ts, hour24Clock);
|
||||
|
||||
let time = '';
|
||||
|
|
@ -37,7 +39,14 @@ export const Time = as<'span', TimeProps & ComponentProps<typeof Text>>(
|
|||
}
|
||||
|
||||
return (
|
||||
<Text as="time" style={{ flexShrink: 0 }} size="T200" priority="300" {...props} ref={ref}>
|
||||
<Text
|
||||
as="time"
|
||||
className={classNames(css.Time, className)}
|
||||
size="T200"
|
||||
priority="300"
|
||||
{...props}
|
||||
ref={ref}
|
||||
>
|
||||
{time}
|
||||
</Text>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue