menu-option.svelte 477 B

1234567891011121314151617181920212223242526
  1. <script>
  2. import { createEventDispatcher } from 'svelte';
  3. export let isDisabled = false;
  4. export let text = '';
  5. const dispatch = createEventDispatcher();
  6. const handleClick = () => {
  7. if (isDisabled) return;
  8. dispatch('click');
  9. };
  10. </script>
  11. <button
  12. class:disabled={isDisabled}
  13. on:click={handleClick}
  14. class="bg-white hover:bg-gray-300 dark:text-immich-dark-bg transition-all p-4 w-full text-left text-sm"
  15. >
  16. {#if text}
  17. {text}
  18. {:else}
  19. <slot />
  20. {/if}
  21. </button>