github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/utils/layout.ts (about)

     1  // Needs to be a single unbroken string so that the tailwind content purging
     2  // includes the class
     3  // TODO try intermediate state - anything less than 6 is 6
     4  const getResponsivePanelWidthClass = (width: number | undefined): string => {
     5    switch (width) {
     6      case 0:
     7        // Hide anything with no width
     8        return "hidden";
     9      case 1:
    10        return "md:col-span-3 lg:col-span-1";
    11      case 2:
    12        return "md:col-span-3 lg:col-span-2";
    13      case 3:
    14        return "md:col-span-3";
    15      case 4:
    16        return "md:col-span-6 lg:col-span-4";
    17      case 5:
    18        return "md:col-span-6 lg:col-span-5";
    19      case 6:
    20        return "md:col-span-6";
    21      case 7:
    22        return "md:col-span-7";
    23      case 8:
    24        return "md:col-span-8";
    25      case 9:
    26        return "md:col-span-9";
    27      case 10:
    28        return "md:col-span-10";
    29      case 11:
    30        return "md:col-span-11";
    31      default:
    32        // 12 or anything else returns empty string
    33        // and accepts our default grid behaviour
    34        return "";
    35    }
    36  };
    37  
    38  export { getResponsivePanelWidthClass };