-
Notifications
You must be signed in to change notification settings - Fork 374
Expand file tree
/
Copy pathMetadata.tsx
More file actions
47 lines (44 loc) · 1.17 KB
/
Metadata.tsx
File metadata and controls
47 lines (44 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react'
import { HorizontalContainer } from '../HorizontalContainer/HorizontalContainer'
import { cn } from '@/utils'
export interface MetadataProps extends React.HTMLAttributes<HTMLDivElement> {
label: React.ReactNode
value: React.ReactNode
}
export const Metadata = React.forwardRef<HTMLDivElement, MetadataProps>(
({ label, value, className, ...props }, ref) => {
return (
<HorizontalContainer
ref={ref}
data-component="Metadata"
className={cn(
'Metadata justify-between gap-2 items-center whitespace-nowrap h-auto',
className,
)}
{...props}
>
{typeof label === 'string' ? (
<div
title={label}
className="text-metadata-label truncate shrink-0"
>
{label}
</div>
) : (
label
)}
{typeof value === 'string' ? (
<div
title={value}
className="text-metadata-value font-semibold truncate"
>
{value}
</div>
) : (
value
)}
</HorizontalContainer>
)
},
)
Metadata.displayName = 'Metadata'