mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-28 11:33:02 +00:00
refactor: batch 3
This commit is contained in:
21
src/components/KeyListContainer.tsx
Normal file
21
src/components/KeyListContainer.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { ReactNode, RefObject } from 'react';
|
||||
|
||||
export interface KeyListContainerProps {
|
||||
keys: unknown[];
|
||||
children?: ReactNode;
|
||||
ref?: RefObject<HTMLDivElement | null>;
|
||||
}
|
||||
|
||||
export function KeyListContainer({ keys, children, ref }: KeyListContainerProps) {
|
||||
const count = keys.length;
|
||||
return (
|
||||
<div ref={ref} className="flex grow min-h-0 overflow-auto pr-4 pt-3">
|
||||
{count > 0 && (
|
||||
<ul className="list bg-base-100 rounded-box shadow-md border border-base-300 w-full min-h-0 max-h-[30rem] overflow-auto">
|
||||
{children}
|
||||
</ul>
|
||||
)}
|
||||
{count === 0 && <p>还没有添加密钥。</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user