Web player general changes #22
@@ -1,6 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
|
|
||||||
|
import { pop } from '$lib/utils/transitions';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
class?: string;
|
class?: string;
|
||||||
style?: string;
|
style?: string;
|
||||||
@@ -12,9 +14,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="glass-panel animate-pop rounded-panel p-1.5 {border
|
transition:pop|global
|
||||||
? 'border border-hairline'
|
class="glass-panel rounded-panel p-1.5 {border ? 'border border-hairline' : ''} {klass}"
|
||||||
: ''} {klass}"
|
|
||||||
{style}
|
{style}
|
||||||
>
|
>
|
||||||
{@render children()}
|
{@render children()}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
import X from '@lucide/svelte/icons/x';
|
import X from '@lucide/svelte/icons/x';
|
||||||
import IconButton from '../primitives/IconButton.svelte';
|
import IconButton from '../primitives/IconButton.svelte';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { expoOut } from 'svelte/easing';
|
import { pop } from '$lib/utils/transitions';
|
||||||
import type { TransitionConfig } from 'svelte/transition';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -48,15 +47,6 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pop(node: Element, { duration = 200 }: { duration?: number } = {}): TransitionConfig {
|
|
||||||
return {
|
|
||||||
duration,
|
|
||||||
easing: expoOut,
|
|
||||||
css: (t) =>
|
|
||||||
`opacity: ${t}; transform: scale(${0.98 + 0.02 * t}) translateY(${0.25 * (1 - t)}rem);`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function onWindowKeydown(event: KeyboardEvent) {
|
function onWindowKeydown(event: KeyboardEvent) {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
if (event.key === 'Escape') {
|
if (event.key === 'Escape') {
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { expoOut } from 'svelte/easing';
|
||||||
|
import type { TransitionConfig } from 'svelte/transition';
|
||||||
|
|
||||||
|
export function pop(
|
||||||
|
node: Element,
|
||||||
|
{ duration = 200 }: { duration?: number } = {}
|
||||||
|
): TransitionConfig {
|
||||||
|
return {
|
||||||
|
duration,
|
||||||
|
easing: expoOut,
|
||||||
|
css: (t) =>
|
||||||
|
`opacity: ${t}; transform: scale(${0.98 + 0.02 * t}) translateY(${0.25 * (1 - t)}rem);`
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user