adrema/resources/js/composables/useFieldSize.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-02-02 01:05:45 +01:00
import {ref, inject, computed, onBeforeUnmount} from 'vue';
import {router} from '@inertiajs/vue3';
import useQueueEvents from './useQueueEvents.js';
export default function () {
const sizes = {
sm: {
label: 'text-xs',
field: 'text-xs',
},
default: {
label: 'text-sm',
field: 'text-sm',
},
};
const defaultFieldClass = 'border-2 p-2 rounded-lg bg-gray-700 border-gray-600 text-gray-300 border-solid';
2024-06-28 13:43:38 +02:00
const fieldHeight = 'group-[.field-base]:h-[35px] group-[.field-sm]:h-[23px]';
const fieldAppearance =
'group-[.field-base]:border-2 group-[.field-sm]:border border-gray-600 border-solid text-gray-300 bg-gray-700 leading-none rounded-lg group-[.field-base]:text-sm group-[.field-sm]:text-xs';
const paddingX = 'group-[.field-base]:px-2 group-[.field-sm]:px-1';
2024-02-02 01:05:45 +01:00
function labelClass(size) {
return sizes[size ? size : 'default'].label;
}
function fieldClass(size) {
return sizes[size ? size : 'default'].field;
}
return {
labelClass,
fieldClass,
defaultFieldClass,
2024-06-28 13:43:38 +02:00
fieldHeight,
fieldAppearance,
paddingX,
2024-02-02 01:05:45 +01:00
};
}