statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Add "missing" tailwind mappings for fieldtype width #2516

Open FrittenKeeZ opened 4 years ago

FrittenKeeZ commented 4 years ago

In order to better layout fields, please add the "missing" tailwind classes to the mappings.

global.tailwind_width_class = function (width) {
    const widths = {
        17: '1/6',
        20: '1/5',
        25: '1/4',
        33: '1/3',
        40: '2/5',
        50: '1/2',
        60: '3/5',
        66: '2/3',
        75: '3/4',
        80: '4/5',
        83: '5/6',
        100: 'full'
    };

    return `w-${widths[width] || 'full'}`;
}