2024-05-27 20:42:34 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2025-01-28 23:23:42 +03:00
|
|
|
import { CProps } from '@/components/props';
|
2024-05-27 20:42:34 +03:00
|
|
|
|
2024-08-23 12:35:48 +03:00
|
|
|
interface ValueLabeledProps extends CProps.Styling {
|
2024-11-21 15:09:51 +03:00
|
|
|
/** Id of the component. */
|
2023-12-28 14:04:44 +03:00
|
|
|
id?: string;
|
2024-11-21 15:09:51 +03:00
|
|
|
|
|
|
|
/** Label to display. */
|
2023-12-28 14:04:44 +03:00
|
|
|
label: string;
|
2024-11-21 15:09:51 +03:00
|
|
|
|
|
|
|
/** Value to display. */
|
2023-12-28 14:04:44 +03:00
|
|
|
text: string | number;
|
2024-11-21 15:09:51 +03:00
|
|
|
|
|
|
|
/** Tooltip for the component. */
|
2023-12-28 14:04:44 +03:00
|
|
|
title?: string;
|
2023-07-18 14:55:40 +03:00
|
|
|
}
|
|
|
|
|
2024-11-21 15:09:51 +03:00
|
|
|
/**
|
|
|
|
* Displays a labeled value.
|
|
|
|
*/
|
2024-08-23 12:35:48 +03:00
|
|
|
function ValueLabeled({ id, label, text, title, className, ...restProps }: ValueLabeledProps) {
|
2023-07-18 14:55:40 +03:00
|
|
|
return (
|
2024-06-02 23:41:46 +03:00
|
|
|
<div className={clsx('flex justify-between gap-6', className)} {...restProps}>
|
2024-03-18 16:21:39 +03:00
|
|
|
<span title={title}>{label}</span>
|
2023-12-28 14:04:44 +03:00
|
|
|
<span id={id}>{text}</span>
|
|
|
|
</div>
|
|
|
|
);
|
2023-07-18 14:55:40 +03:00
|
|
|
}
|
|
|
|
|
2024-08-23 12:35:48 +03:00
|
|
|
export default ValueLabeled;
|