aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/@next/constants/utilities.tsx
blob: 0d626c91b36f7b7bb97b8d0c6f8e0aefab639718 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export interface PaddingInterface {
    padding?: number | Array<'large' | 'default' | 'small' | number>;
    margin?: number | Array<'large' | 'default' | 'small' | number>;
}

interface PaddingSizes {
    [key: string]: string;
}

export const PADDING_SIZES: PaddingSizes = {
    'default': '30px',
    'large': '60px',
    'small': '15px',
};

export const getCSSPadding = (value: number | Array<string | number> = 0): string => {
    if (Array.isArray(value)) {
        return value.map(val => PADDING_SIZES[val] || `${val}px`).join(' ');
    } else {
        return `${value}px`;
    }
};