Skip to content

Commit

Permalink
style: improve transition effects for PostSlider and RightSlider by a…
Browse files Browse the repository at this point in the history
… hack way
  • Loading branch information
dribble-njr committed Jan 9, 2025
1 parent f11c31c commit 8041617
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/components/CodemirrorEditor/PostSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ function delPost() {

<template>
<div
class="overflow-hidden bg-gray/20 transition-width dark:bg-gray/40"
class="overflow-hidden bg-gray/20 transition-width duration-300 dark:bg-gray/40"
:class="{
'w-0': !store.isOpenPostSlider,
'w-50': store.isOpenPostSlider,
}"
>
<nav class="space-y-1 h-full overflow-auto p-2">
<nav
class="space-y-1 h-full overflow-auto p-2 transition-transform"
:class="{
'translate-x-100': store.isOpenPostSlider,
'-translate-x-full': !store.isOpenPostSlider,
}"
>
<Dialog v-model:open="isOpen">
<DialogTrigger as-child>
<Button variant="outline" class="w-full" size="xs">
Expand All @@ -86,10 +92,7 @@ function delPost() {
</DialogContent>
</Dialog>
<a
v-for="(post, index) in store.posts"
:key="post.title"
href="#"
:class="{
v-for="(post, index) in store.posts" :key="post.title" href="#" :class="{
'bg-primary text-primary-foreground shadow-lg border-2 border-primary': store.currentPostIndex === index,
'dark:bg-primary-dark dark:text-primary-foreground-dark dark:border-primary-dark': store.currentPostIndex === index,
}"
Expand Down
9 changes: 7 additions & 2 deletions src/components/CodemirrorEditor/RightSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ const formatOptions = ref<Format[]>([`rgb`, `hex`, `hsl`, `hsv`])

<template>
<div
class="overflow-hidden bg-gray/20 transition-width dark:bg-gray/40"
class="overflow-hidden bg-gray/20 transition-width duration-300 dark:bg-gray/40"
:class="{
'w-0': !store.isOpenRightSlider,
'w-100': store.isOpenRightSlider,
}"
>
<div class="space-y-4 h-full overflow-auto p-4">
<div
class="space-y-4 h-full overflow-auto p-4 transition-transform" :class="{
'translate-x-0': store.isOpenRightSlider,
'translate-x-full': !store.isOpenRightSlider,
}"
>
<div class="space-y-2">
<h2>主题</h2>
<div class="grid grid-cols-3 justify-items-center gap-2">
Expand Down

0 comments on commit 8041617

Please sign in to comment.