UNPKG

@glance-networks/agent-plugin

Version:

Glance Networks Agent Plugin

33 lines (32 loc) 886 B
import { theme } from '@glance-design/tailwind-config'; const spacing = theme?.spacing ?? {}; export const getTailwindSpacing = () => { const iconSizes = {}; const MAX_SIZE = 9; const MIN_SIZE = 3; Object.entries(spacing).forEach(([key, value]) => { const size = parseInt(key); if (size >= MIN_SIZE && size <= MAX_SIZE) { if (typeof value === "string") { iconSizes[key] = value; } } }); return iconSizes; }; export const ICON_SIZES = getTailwindSpacing(); /** * @name getAvailableSizes * @description Get all available icon sizes */ export const getAvailableSizes = () => { return Object.keys(ICON_SIZES); }; /** * @name getRandomId * @description Generate a random id * @returns {string} */ export const getRandomId = () => { return Math.random().toString(36).replace('0.', ''); };