circle-icon-button.svelte 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script lang="ts">
  2. /**
  3. * This is the circle icon component.
  4. */
  5. import { createEventDispatcher } from 'svelte';
  6. export let logo: any;
  7. export let backgroundColor: string = 'transparent';
  8. export let hoverColor: string = '#e2e7e9';
  9. export let logoColor: string = '#5f6368';
  10. export let size = '24';
  11. export let title = '';
  12. let iconButton: HTMLButtonElement;
  13. const dispatch = createEventDispatcher();
  14. $: {
  15. if (iconButton) {
  16. iconButton.style.backgroundColor = backgroundColor;
  17. iconButton.style.setProperty('--immich-icon-button-hover-color', hoverColor);
  18. }
  19. }
  20. </script>
  21. <button
  22. {title}
  23. bind:this={iconButton}
  24. class={`immich-circle-icon-button rounded-full p-3 flex place-items-center place-content-center transition-all`}
  25. on:click={() => dispatch('click')}
  26. >
  27. <svelte:component this={logo} {size} color={logoColor} />
  28. </button>
  29. <style>
  30. :root {
  31. --immich-icon-button-hover-color: #d3d3d3;
  32. }
  33. .immich-circle-icon-button:hover {
  34. background-color: var(--immich-icon-button-hover-color) !important;
  35. }
  36. </style>