mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-05 23:18:53 -05:00
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { MediaListRow } from './MediaListRow';
|
|
import { BulkActionsDropdown } from './BulkActionsDropdown';
|
|
import { SelectAllCheckbox } from './SelectAllCheckbox';
|
|
import './MediaListWrapper.scss';
|
|
|
|
interface MediaListWrapperProps {
|
|
title?: string;
|
|
viewAllLink?: string;
|
|
viewAllText?: string;
|
|
className?: string;
|
|
style?: { [key: string]: any };
|
|
children?: any;
|
|
showBulkActions?: boolean;
|
|
selectedCount?: number;
|
|
totalCount?: number;
|
|
onBulkAction?: (action: string) => void;
|
|
onSelectAll?: () => void;
|
|
onDeselectAll?: () => void;
|
|
}
|
|
|
|
export const MediaListWrapper: React.FC<MediaListWrapperProps> = ({
|
|
title,
|
|
viewAllLink,
|
|
viewAllText,
|
|
className,
|
|
style,
|
|
children,
|
|
showBulkActions = false,
|
|
selectedCount = 0,
|
|
totalCount = 0,
|
|
onBulkAction = () => {},
|
|
onSelectAll = () => {},
|
|
onDeselectAll = () => {},
|
|
}) => (
|
|
<div className={(className ? className + ' ' : '') + 'media-list-wrapper'} style={style}>
|
|
<MediaListRow title={title} viewAllLink={viewAllLink} viewAllText={viewAllText}>
|
|
{showBulkActions && (
|
|
<div className="bulk-actions-container">
|
|
<BulkActionsDropdown selectedCount={selectedCount} onActionSelect={onBulkAction} />
|
|
<SelectAllCheckbox
|
|
totalCount={totalCount}
|
|
selectedCount={selectedCount}
|
|
onSelectAll={onSelectAll}
|
|
onDeselectAll={onDeselectAll}
|
|
/>
|
|
</div>
|
|
)}
|
|
{children || null}
|
|
</MediaListRow>
|
|
</div>
|
|
);
|