mirror of https://github.com/VERT-sh/VERT.git
fix: chromium/webkit card fix, tooltip warning
This commit is contained in:
parent
3993cd2e06
commit
98e91337db
|
@ -177,7 +177,7 @@
|
||||||
"navbar": {
|
"navbar": {
|
||||||
"upload": "Upwoad",
|
"upload": "Upwoad",
|
||||||
"convert": "Conwewt",
|
"convert": "Conwewt",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"toggle_theme": "Toggwe theme"
|
"toggle_theme": "Toggwe theme"
|
||||||
},
|
},
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<span
|
||||||
bind:this={triggerElement}
|
bind:this={triggerElement}
|
||||||
class="relative inline-block {className}"
|
class="relative inline-block {className}"
|
||||||
onmouseenter={show}
|
onmouseenter={show}
|
||||||
|
@ -67,10 +67,10 @@
|
||||||
role="tooltip"
|
role="tooltip"
|
||||||
>
|
>
|
||||||
{@render children()}
|
{@render children()}
|
||||||
</div>
|
</span>
|
||||||
|
|
||||||
{#if showTooltip}
|
{#if showTooltip}
|
||||||
<div
|
<span
|
||||||
class="tooltip tooltip-{position}"
|
class="tooltip tooltip-{position}"
|
||||||
style="left: {tooltipPosition.x}px; top: {tooltipPosition.y}px;"
|
style="left: {tooltipPosition.x}px; top: {tooltipPosition.y}px;"
|
||||||
transition:fade={{
|
transition:fade={{
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{text}
|
{text}
|
||||||
</div>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -78,16 +78,35 @@
|
||||||
// svelte-ignore state_referenced_locally
|
// svelte-ignore state_referenced_locally
|
||||||
let showBlur = $state(Array(Object.keys(status).length).fill(false));
|
let showBlur = $state(Array(Object.keys(status).length).fill(false));
|
||||||
|
|
||||||
const checkScrollable = (index: number) => {
|
|
||||||
const container = scrollContainers[index];
|
|
||||||
if (!container) return;
|
|
||||||
showBlur[index] = container.scrollHeight > container.clientHeight;
|
|
||||||
};
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
const isFirefox = /firefox/i.test(navigator.userAgent);
|
||||||
|
|
||||||
const handleResize = () => {
|
const handleResize = () => {
|
||||||
for (let i = 0; i < scrollContainers.length; i++)
|
for (let i = 0; i < scrollContainers.length; i++) {
|
||||||
checkScrollable(i);
|
// show bottom blur if scrollable
|
||||||
|
const container = scrollContainers[i];
|
||||||
|
if (!container) return;
|
||||||
|
showBlur[i] = container.scrollHeight > container.clientHeight;
|
||||||
|
|
||||||
|
// if not on firefox, add ml-2 to card content if scrollable
|
||||||
|
// doing this because i can't figure out how to make the scrollbar *not* take up DOM space (shifting the contents to the left)
|
||||||
|
if (!isFirefox && scrollContainers[i]) {
|
||||||
|
const card = scrollContainers[i].closest(
|
||||||
|
".file-category-card",
|
||||||
|
);
|
||||||
|
const cardContent = card?.querySelector(
|
||||||
|
".file-category-card-content",
|
||||||
|
);
|
||||||
|
if (cardContent) {
|
||||||
|
const hasML2 = cardContent.classList.contains("ml-2");
|
||||||
|
if (showBlur[i] && !hasML2) {
|
||||||
|
cardContent.classList.add("ml-2");
|
||||||
|
} else if (!showBlur[i] && hasML2) {
|
||||||
|
cardContent.classList.remove("ml-2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleResize();
|
handleResize();
|
||||||
|
|
Loading…
Reference in New Issue