- add CreateEnvironmentPage and EditEnvironmentPage with pre-filled form - add /environments/new and /environments/:id/edit routes - add Edit option to card context menu and detail page toolbar - move env id pill to card footer (left), timestamp stays right - make env cards clickable (navigate to detail); cog stops propagation - add hoverable Card variant with primary border+shadow on hover - add link color tokens and global anchor styles for both themes - fix Timestamp pill visibility in dark mode with border token - add DescriptionList truncate prop with ellipsis and title tooltip - stack DescriptionList dd below dt with 8px gap between items
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import styles from './Card.module.css';
|
|
|
|
export interface CardProps {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
padding?: 'sm' | 'md' | 'lg';
|
|
header?: React.ReactNode;
|
|
headerVariant?: 'primary' | 'secondary';
|
|
footer?: React.ReactNode;
|
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
}
|
|
|
|
export function Card({
|
|
children,
|
|
className,
|
|
padding = 'md',
|
|
header,
|
|
headerVariant = 'primary',
|
|
footer,
|
|
onClick,
|
|
}: CardProps) {
|
|
return (
|
|
<div
|
|
onClick={onClick}
|
|
className={[
|
|
styles.card,
|
|
footer !== undefined ? styles.withFooter : '',
|
|
onClick ? styles.hoverable : '',
|
|
className,
|
|
]
|
|
.filter(Boolean)
|
|
.join(' ')}
|
|
>
|
|
{header !== undefined && (
|
|
<div className={[styles.header, styles[`header-${headerVariant}`]].join(' ')}>{header}</div>
|
|
)}
|
|
<div className={[styles.body, styles[padding]].join(' ')}>{children}</div>
|
|
{footer !== undefined && <div className={styles.footer}>{footer}</div>}
|
|
</div>
|
|
);
|
|
}
|