UNPKG

@orfeas126/box-ui-elements

Version:
64 lines (63 loc) 1.96 kB
/** * * @file Content sub header component * @author Box */ import * as React from 'react'; import Sort from './Sort'; import Add from './Add'; import GridViewSlider from '../../../components/grid-view/GridViewSlider'; import ViewModeChangeButton from './ViewModeChangeButton'; import { VIEW_FOLDER, VIEW_MODE_GRID } from '../../../constants'; import './SubHeaderRight.scss'; const SubHeaderRight = ({ canCreateNewFolder, canUpload, currentCollection, gridColumnCount, gridMaxColumns, gridMinColumns, maxGridColumnCountForWidth, onCreate, onGridViewSliderChange, onSortChange, onUpload, onViewModeChange, view, viewMode }) => { const { sortBy, sortDirection, items = [] } = currentCollection; const hasGridView = !!gridColumnCount; const hasItems = items.length > 0; const isFolder = view === VIEW_FOLDER; const showSort = isFolder && hasItems; const showAdd = (!!canUpload || !!canCreateNewFolder) && isFolder; return /*#__PURE__*/React.createElement("div", { className: "be-sub-header-right" }, hasItems && viewMode === VIEW_MODE_GRID && /*#__PURE__*/React.createElement(GridViewSlider, { columnCount: gridColumnCount, gridMaxColumns: gridMaxColumns, gridMinColumns: gridMinColumns, maxColumnCount: maxGridColumnCountForWidth, onChange: onGridViewSliderChange }), hasItems && hasGridView && /*#__PURE__*/React.createElement(ViewModeChangeButton, { viewMode: viewMode, onViewModeChange: onViewModeChange }), showSort && !!sortBy && !!sortDirection && /*#__PURE__*/React.createElement(Sort, { onSortChange: onSortChange, sortBy: sortBy, sortDirection: sortDirection }), showAdd && /*#__PURE__*/React.createElement(Add, { isDisabled: !isFolder, onCreate: onCreate, onUpload: onUpload, showCreate: canCreateNewFolder, showUpload: canUpload })); }; export default SubHeaderRight; //# sourceMappingURL=SubHeaderRight.js.map