Compare commits

...

3 commits

Author SHA1 Message Date
hippoz
537036e8bb
apply transitions to sidebars on large viewports 2022-08-28 16:02:51 +03:00
hippoz
fc8d81753e
improve conditional animations 2022-08-28 16:02:28 +03:00
hippoz
9d1d91711e
improve sidebar contrast 2022-08-28 15:25:18 +03:00
4 changed files with 23 additions and 5 deletions

View file

@ -12,7 +12,7 @@
/* top-level */ /* top-level */
:root { :root {
--background-color-0: hsl(180, 11%, 6%); --background-color-0: hsl(180, 11%, 5%);
--background-color-1: hsl(180, 11%, 7%); --background-color-1: hsl(180, 11%, 7%);
--background-color-2: hsl(180, 11%, 10%); --background-color-2: hsl(180, 11%, 10%);
--background-color-3: hsl(180, 11%, 13%); --background-color-3: hsl(180, 11%, 13%);

View file

@ -13,9 +13,27 @@ export function maybeModalFly(node) {
export function maybeFly(...e) { export function maybeFly(...e) {
if (getItem("ui:doAnimations")) if (getItem("ui:doAnimations"))
return fly(...e); return fly(...e);
else
return fly(e[0], { duration: 0 });
} }
export function maybeFade(...e) { export function maybeFade(...e) {
if (getItem("ui:doAnimations")) if (getItem("ui:doAnimations"))
return fade(...e); return fade(...e);
else
return fade(e[0], { duration: 0 });
}
export function maybeFlyIf(...e) {
if (getItem("ui:doAnimations") && e[1] && e[1]._condition)
return fly(...e);
else
return fly(e[0], { duration: 0 });
}
export function maybeFadeIf(...e) {
if (getItem("ui:doAnimations") && e[1] && e[1]._condition)
return fade(...e);
else
return fade(e[0], { duration: 0 });
} }

View file

@ -1,7 +1,7 @@
<script> <script>
import { ArrowLeftIcon, AtSignIcon } from "svelte-feather-icons"; import { ArrowLeftIcon, AtSignIcon } from "svelte-feather-icons";
import { quadInOut } from "svelte/easing"; import { quadInOut } from "svelte/easing";
import { maybeFly } from "../animations"; import { maybeFly, maybeFlyIf } from "../animations";
import { presenceStore, showChannelView, showPresenceSidebar, smallViewport } from "../stores"; import { presenceStore, showChannelView, showPresenceSidebar, smallViewport } from "../stores";
let pendingExit = false; let pendingExit = false;
@ -11,7 +11,7 @@
}; };
</script> </script>
<div class="sidebar-container" in:maybeFly="{{ duration: 175, easing: quadInOut, x: 10 }}"> <div class="sidebar-container" in:maybeFly="{{ duration: 175, easing: quadInOut, x: 10 }}" out:maybeFlyIf="{{ _condition: !smallViewport.value, duration: 175, easing: quadInOut, x: -10 }}">
<div class="top-bar"> <div class="top-bar">
<span class="input-label">User List</span> <span class="input-label">User List</span>
</div> </div>

View file

@ -1,7 +1,7 @@
<script> <script>
import { HashIcon, PlusIcon, MoreVerticalIcon, SettingsIcon, CloudIcon } from "svelte-feather-icons"; import { HashIcon, PlusIcon, MoreVerticalIcon, SettingsIcon, CloudIcon } from "svelte-feather-icons";
import { quadInOut } from "svelte/easing"; import { quadInOut } from "svelte/easing";
import { maybeFly } from "../animations"; import { maybeFly, maybeFlyIf } from "../animations";
import { channels, gatewayStatus, overlayStore, selectedChannel, showChannelView, showSidebar, smallViewport, userInfoStore } from "../stores"; import { channels, gatewayStatus, overlayStore, selectedChannel, showChannelView, showSidebar, smallViewport, userInfoStore } from "../stores";
import UserTopBar from "./UserTopBar.svelte"; import UserTopBar from "./UserTopBar.svelte";
@ -14,7 +14,7 @@
} }
</script> </script>
<div class="sidebar-container" in:maybeFly="{{ duration: 175, easing: quadInOut, x: -10 }}"> <div class="sidebar-container" in:maybeFly="{{ duration: 175, easing: quadInOut, x: -10 }}" out:maybeFlyIf="{{ _condition: !smallViewport.value, duration: 175, easing: quadInOut, x: -10 }}">
<UserTopBar /> <UserTopBar />
<div class="sidebar"> <div class="sidebar">
{#each $channels as channel (channel.id)} {#each $channels as channel (channel.id)}