| 9 | } |
| 10 | |
| 11 | export function KeyValue({ href, onClick, name, value }: KeyValueProps) { |
| 12 | const clickable = href || onClick; |
| 13 | const Component = (href ? Link : onClick ? 'button' : 'div') as 'button'; |
| 14 | |
| 15 | return ( |
| 16 | <Component |
| 17 | className={cn( |
| 18 | 'group flex min-w-0 max-w-full divide-x self-start overflow-hidden rounded-md border border-border text-sm font-medium transition-transform', |
| 19 | clickable && 'hover:-translate-y-0.5', |
| 20 | )} |
| 21 | {...{ href, onClick }} |
| 22 | > |
| 23 | <div className="bg-black/5 p-1 px-2 capitalize">{name}</div> |
| 24 | <div |
| 25 | className={cn( |
| 26 | 'font-mono overflow-hidden max-w-[300px] text-ellipsis whitespace-nowrap bg-card p-1 px-2 text-highlight', |
| 27 | clickable && 'group-hover:underline', |
| 28 | )} |
| 29 | > |
| 30 | {value} |
| 31 | </div> |
| 32 | </Component> |
| 33 | ); |
| 34 | } |