UNPKG

@nuxt/ui

Version:

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.

31 lines (30 loc) 731 B
import { get } from "./index.js"; function hasDescription(item, descriptionKey) { if (typeof item !== "object" || item === null) { return false; } const value = get(item, descriptionKey); return value !== void 0 && value !== null && value !== ""; } function getSize(size, hasDescription2) { if (hasDescription2) { return { xs: 44, sm: 48, md: 52, lg: 56, xl: 60 }[size]; } return { xs: 24, sm: 28, md: 32, lg: 36, xl: 40 }[size]; } export function getEstimateSize(items, size, descriptionKey) { const anyHasDescription = descriptionKey ? items.some((item) => hasDescription(item, descriptionKey)) : false; return getSize(size, anyHasDescription); }