
const newColor = 'blue';
export default function button(token, title, icon) {
    const formCall = `window.v3plugin.$form({ token: '${token}' })`;

    const buttonClass = icon
    ? `size-8 inline-flex justify-center items-center gap-x-2 font-medium rounded-s-lg border border-stone-200 bg-${newColor}-100 text-stone-800 shadow-sm hover:bg-${newColor}-200 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-${newColor}-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 `
    : `px-2 py-1 inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border border-transparent hover:text-white ring-offset-white bg-${newColor}-100 text-${newColor}-500 hover:bg-${newColor}-500 focus:ring-${newColor}-500`;

    const buttonContent = icon
    ? `<svg class="shrink-0 size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${newColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"></path>
            <path d="m15 5 4 4"></path>
        </svg>`
    : `${title || 'Редагувати'}`;

    return `<button onclick="${formCall}" class="${buttonClass}">${buttonContent}</button>`;
    
}