VistaToggle.svelte 1.55 KB
<script>
  let { vista = $bindable('agregado') } = $props();

  function toggle() {
    vista = vista === 'agregado' ? 'comparar' : 'agregado';
  }
</script>

<button class="vista-btn" onclick={toggle}>
  {#if vista === 'agregado'}
    Comparar entre entidades
    <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
      <path d="M5 12h14M12 5l7 7-7 7"/>
    </svg>
  {:else}
    <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
      <path d="M19 12H5M12 19l-7-7 7-7"/>
    </svg>
    Ver todo
  {/if}
</button>

<style>
  .vista-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'Qanelas', var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0;
    border: none;
    background: transparent;
    color: #666666;
    cursor: pointer;
    transition: color 0.15s ease;
    white-space: nowrap;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    text-decoration-color: #666666;
  }

  .vista-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
  }

  .vista-btn:hover {
    color: #999999;
    text-decoration-color: #666666;
  }

  .vista-btn:hover svg {
    opacity: 1;
  }

  .vista-btn:active {
    color: #555555;
  }

  :global(html.dark) .vista-btn {
    color: rgba(255, 255, 255, 0.6);
    text-decoration-color: rgba(255, 255, 255, 0.4);
  }

  :global(html.dark) .vista-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    text-decoration-color: rgba(255, 255, 255, 0.5);
  }
</style>