Skip to content

Commit

Permalink
renderer: fix tab slide transition for Comment and ColorPicker
Browse files Browse the repository at this point in the history
  • Loading branch information
rocka committed Jul 19, 2023
1 parent c2f0379 commit 487908b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 34 deletions.
5 changes: 2 additions & 3 deletions src/renderer/page/Comment/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
<span>写评论</span>
</mu-button>
</mu-tabs>
<div class="list-wrapper">
<transition mode="out-in"
:name="transitionName">
<div class="list-wrapper slide-anim-container">
<transition :name="transitionName">
<keep-alive>
<CommentList :key="tab"
:thread="thread"
Expand Down
61 changes: 32 additions & 29 deletions src/renderer/page/Settings/ColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,35 @@
:width="500"
:open="open"
@close="handleClose">
<transition :name="transitionName"
mode="out-in">
<div :key="activeGroup"
class="buttons-wrapper">
<template v-if="activeGroup < 0">
<mu-button v-for="(group, index) in ColorGroups"
fab
:color="group.primary"
:key="group.primary"
@click="handleGroup(index)">
</mu-button>
</template>
<template v-else>
<mu-button class="color-picker__back"
fab
color="transparent"
textColor="grey"
@click="handleGroup(-1)">
<mu-icon value="arrow_back"></mu-icon>
</mu-button>
<mu-button v-for="color in ColorGroups[activeGroup].varieties"
fab
:key="color"
:color="color"
@click="handleSelect(color)"></mu-button>
</template>
</div>
</transition>
<div class="slide-anim-container">
<transition :name="transitionName">
<div :key="activeGroup"
class="buttons-wrapper">
<template v-if="activeGroup < 0">
<mu-button v-for="(group, index) in ColorGroups"
fab
:color="group.primary"
:key="group.primary"
@click="handleGroup(index)">
</mu-button>
</template>
<template v-else>
<mu-button class="color-picker__back"
fab
color="transparent"
textColor="grey"
@click="handleGroup(-1)">
<mu-icon value="arrow_back"></mu-icon>
</mu-button>
<mu-button v-for="color in ColorGroups[activeGroup].varieties"
fab
:key="color"
:color="color"
@click="handleSelect(color)"></mu-button>
</template>
</div>
</transition>
</div>
<template #actions>
<mu-button flat
color="primary"
Expand Down Expand Up @@ -102,8 +103,10 @@ export default {

<style lang="less">
.color-picker {
.slide-anim-container {
min-height: 192px;
}
.buttons-wrapper {
height: 192px;
.color-picker__back {
vertical-align: top;
}
Expand Down
8 changes: 6 additions & 2 deletions src/renderer/transition.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
position: relative;
}

.slide-left-enter-active,
.slide-left-leave-active,
.slide-right-enter-active,
.slide-right-leave-active {
position: absolute;
width: 100%;
}

.slide-left-enter-active,
.slide-left-leave-active,
.slide-right-enter-active,
.slide-right-leave-active {
transition-duration: 0.3s;
transition-property: transform, opacity;
transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1);
Expand Down

0 comments on commit 487908b

Please sign in to comment.