VistaToggle.svelte
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<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>