feat(client): add Card header/footer, DescriptionList, and portal ContextMenu
- add Card header prop (primary/secondary variants) and footer prop (sticks to bottom) - add Breadcrumbs to all 5 pages; remove duplicate h1 headings - add pageToolbar layout for breadcrumbs + danger button aligned right - add DescriptionList component replacing raw dl/dt/dd markup; supports truncate+tooltip - rewrite ContextMenu to render dropdown via React portal to avoid clip/overflow issues - update EnvironmentCard to use Card header (primary), footer (Timestamp), and truncated DescriptionList - fix cog button contrast, square sizing, and right-edge alignment on colored header - add border to Timestamp pill for dark-mode visibility - add id badge pill styling to environment card header
This commit is contained in:
1 parent
35997f8bcb
commit
89016b01d2
13 files changed
+359
-97
No files matched your search
@@ -0,0 +1,39 @@
|
||||
.list {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0;
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.term {
|
||||
color: var(--color-text-muted);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
font-size: var(--font-size-xs);
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.detail {
|
||||
margin: 0;
|
||||
color: var(--color-text);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
word-break: normal;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import React from 'react';
|
||||
import styles from './DescriptionList.module.css';
|
||||
|
||||
function extractText(node: React.ReactNode): string {
|
||||
if (typeof node === 'string' || typeof node === 'number') return String(node);
|
||||
if (Array.isArray(node)) return node.map(extractText).join('');
|
||||
if (React.isValidElement(node)) return extractText(node.props.children);
|
||||
return '';
|
||||
}
|
||||
|
||||
export interface DescriptionListItem {
|
||||
term: React.ReactNode;
|
||||
detail: React.ReactNode;
|
||||
}
|
||||
|
||||
export interface DescriptionListProps {
|
||||
items: DescriptionListItem[];
|
||||
/** 'compact' stacks term above detail; 'inline' places them side by side (default) */
|
||||
layout?: 'inline' | 'compact';
|
||||
/** Truncate detail values with ellipsis; full value shown in a tooltip on hover */
|
||||
truncate?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function DescriptionList({ items, layout = 'inline', truncate, className }: DescriptionListProps) {
|
||||
return (
|
||||
<dl className={[styles.list, styles[layout], className].filter(Boolean).join(' ')}>
|
||||
{items.map((item, i) => (
|
||||
<div key={i} className={styles.row}>
|
||||
<dt className={styles.term}>{item.term}</dt>
|
||||
<dd
|
||||
className={[styles.detail, truncate ? styles.truncate : ''].filter(Boolean).join(' ')}
|
||||
title={truncate ? extractText(item.detail) : undefined}
|
||||
>
|
||||
{item.detail}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user