UNPKG

@cainiaofe/cn-ui-m

Version:
27 lines (26 loc) 944 B
import { useContext, useMemo } from 'react'; import { CardItemsStateCtx } from '../context/card-items'; export function useLoadMoreStyle() { var _a = useContext(CardItemsStateCtx), totalCount = _a.totalCount, showSelect = _a.showSelect, toolbarButtons = _a.toolbarButtons; var showTotal = totalCount && totalCount !== 0; var showInfo = showTotal || showSelect; var showButtons = Boolean(toolbarButtons.length); return useMemo(function () { var temp = 0; // 数量信息展示高度 if (showInfo) temp += 20; // 上下高度 if (showButtons) temp += 44; // 上下边距 if (showInfo || showButtons) temp += 24; // 数量信息好按钮高度间距 if (showInfo && showButtons) temp += 10; if (temp) return { paddingBottom: temp }; return {}; }, [showButtons, showInfo]); }