Merge remote-tracking branch 'upstream/main' into file-name-options

This commit is contained in:
JovannMC 2024-11-15 11:04:51 +03:00
commit 890905756b
No known key found for this signature in database
4 changed files with 34 additions and 10 deletions

View File

@ -39,6 +39,7 @@
--fg-muted-alt: hsl(0, 0%, 75%); --fg-muted-alt: hsl(0, 0%, 75%);
--fg-highlight: hsl(303, 61%, 47%); --fg-highlight: hsl(303, 61%, 47%);
--fg-failure: hsl(0, 67%, 49%); --fg-failure: hsl(0, 67%, 49%);
color-scheme: light;
} }
@mixin dark { @mixin dark {
@ -51,25 +52,26 @@
--fg-muted-alt: hsl(0, 0%, 25%); --fg-muted-alt: hsl(0, 0%, 25%);
--fg-highlight: hsl(303, 64%, 65%); --fg-highlight: hsl(303, 64%, 65%);
--fg-failure: hsl(0, 67%, 80%); --fg-failure: hsl(0, 67%, 80%);
color-scheme: dark;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body { :root {
@include dark; @include dark;
} }
} }
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
body { :root {
@include light; @include light;
} }
} }
body.light { :root.light {
@include light; @include light;
} }
body.dark { :root.dark {
@include dark; @include dark;
} }

View File

@ -13,6 +13,7 @@
let { options, selected = $bindable(), onselect }: Props = $props(); let { options, selected = $bindable(), onselect }: Props = $props();
let open = $state(false); let open = $state(false);
let hover = $state(false);
let isUp = $state(false); let isUp = $state(false);
let dropdown = $state<HTMLDivElement>(); let dropdown = $state<HTMLDivElement>();
@ -49,6 +50,8 @@
<button <button
class="font-display w-full min-w-fit justify-between overflow-hidden relative cursor-pointer px-3 border-2 border-solid flex items-center bg-background border-foreground-muted-alt rounded-xl p-2 focus:!outline-none" class="font-display w-full min-w-fit justify-between overflow-hidden relative cursor-pointer px-3 border-2 border-solid flex items-center bg-background border-foreground-muted-alt rounded-xl p-2 focus:!outline-none"
onclick={toggle} onclick={toggle}
onmouseenter={() => (hover = true)}
onmouseleave={() => (hover = false)}
> >
<!-- <p>{selected}</p> --> <!-- <p>{selected}</p> -->
<div <div
@ -104,6 +107,7 @@
</button> </button>
{#if open} {#if open}
<div <div
style={hover ? "will-change: opacity, blur, transform" : ""}
transition:blur={{ transition:blur={{
duration, duration,
easing: quintOut, easing: quintOut,

View File

@ -9,12 +9,15 @@
import { files, theme } from "$lib/store/index.svelte"; import { files, theme } from "$lib/store/index.svelte";
import JSCookie from "js-cookie"; import JSCookie from "js-cookie";
import { MoonIcon, SunIcon } from "lucide-svelte"; import { MoonIcon, SunIcon } from "lucide-svelte";
import { onMount } from "svelte";
import { quintOut } from "svelte/easing"; import { quintOut } from "svelte/easing";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import "../app.scss"; import "../app.scss";
let { children, data } = $props(); let { children, data } = $props();
let shouldGoBack = writable(false); let shouldGoBack = writable(false);
let navbar = $state<HTMLDivElement>();
let hover = $state(false);
const links = $derived< const links = $derived<
{ {
@ -53,16 +56,16 @@
$effect(() => { $effect(() => {
if (!browser) return; if (!browser) return;
if (theme.dark) { if (theme.dark) {
document.body.classList.add("dark"); document.documentElement.classList.add("dark");
document.body.classList.remove("light"); document.documentElement.classList.remove("light");
JSCookie.set("theme", "dark", { JSCookie.set("theme", "dark", {
path: "/", path: "/",
sameSite: "lax", sameSite: "lax",
expires: 2147483647, expires: 2147483647,
}); });
} else { } else {
document.body.classList.add("light"); document.documentElement.classList.add("light");
document.body.classList.remove("dark"); document.documentElement.classList.remove("dark");
JSCookie.set("theme", "light", { JSCookie.set("theme", "light", {
path: "/", path: "/",
sameSite: "lax", sameSite: "lax",
@ -70,6 +73,19 @@
}); });
} }
}); });
onMount(() => {
const mouseEnter = () => {
hover = true;
};
const mouseLeave = () => {
hover = false;
};
navbar?.addEventListener("mouseenter", mouseEnter);
navbar?.addEventListener("mouseleave", mouseLeave);
});
</script> </script>
<svelte:head> <svelte:head>
@ -102,6 +118,7 @@
<div <div
class="w-full max-w-screen-md p-1 border-solid border-2 rounded-2xl border-foreground-muted-alt flex mb-10 mx-auto lg:mt-5" class="w-full max-w-screen-md p-1 border-solid border-2 rounded-2xl border-foreground-muted-alt flex mb-10 mx-auto lg:mt-5"
bind:this={navbar}
> >
<div class="md:p-1"> <div class="md:p-1">
<a <a
@ -200,6 +217,7 @@
<div class="w-full"> <div class="w-full">
<div <div
class="absolute top-0 left-0 w-full" class="absolute top-0 left-0 w-full"
style={hover ? "will-change: opacity, blur, transform" : ""}
in:blur={{ in:blur={{
duration, duration,
easing: quintOut, easing: quintOut,

View File

@ -28,8 +28,8 @@ export default {
plugins: [ plugins: [
plugin(function ({ addVariant }) { plugin(function ({ addVariant }) {
addVariant("dynadark", [ addVariant("dynadark", [
"body:not(.light).dark &", ":root:not(.light).dark &",
"@media (prefers-color-scheme: dark) { body:not(.light) &", "@media (prefers-color-scheme: dark) { :root:not(.light) &",
]); ]);
}), }),
], ],