Display custom text for every icon
This commit is contained in:
parent
f2fb54c29f
commit
bffe17fd69
@ -1,10 +1,23 @@
|
|||||||
<script>
|
<script>
|
||||||
export let icon;
|
export let icon;
|
||||||
export let info;
|
export let info;
|
||||||
|
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
function handleMouseover() {
|
||||||
|
dispatch('mouseover', info);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseout() {
|
||||||
|
dispatch('mouseout');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="p-2 cursor-pointer text-center text-3xl"
|
class="p-2 cursor-pointer text-center text-3xl"
|
||||||
|
on:mouseenter={handleMouseover}
|
||||||
|
on:mouseleave={handleMouseout}
|
||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
const icons = [
|
const icons = [
|
||||||
{ icon: '\u{1F6C8}', info: 'Information' }
|
{ icon: '\u{1F6C8}', info: 'Information' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let activeInfo = null;
|
||||||
|
|
||||||
|
function showInfo(info) {
|
||||||
|
activeInfo = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideInfo() {
|
||||||
|
activeInfo = null;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-row w-14 bg-neutral-700">
|
<div class="flex flex-row w-14 bg-neutral-700">
|
||||||
@ -12,9 +22,12 @@
|
|||||||
<Icon
|
<Icon
|
||||||
icon={icon}
|
icon={icon}
|
||||||
info={info}
|
info={info}
|
||||||
|
on:mouseover={(e) => showInfo(e.detail)}
|
||||||
|
on:mouseout={hideInfo}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0 w-52 h-full z-10 p-5 bg-neutral-600 text-gray-100">
|
<div class="shrink-0 w-52 h-full z-10 p-5 bg-neutral-600 text-gray-100">
|
||||||
|
{activeInfo}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user