-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix card header expansion glitch on card collapse
This commit fixes an issue where the card's header would improperly expand to full height during card collapse, leading to a less smooth user experience. Previously, this was caused by the indiscriminate use of `transition: all` in the `.card__expander`, which included unwanted properties in the transition during collapse, such as height. This is solved by using Vue transitions to apply transition only during expansion. Changes: - Introduce a new Vue component, `CardExpandAnimation`: - Centralizes the animation process, applying the same animation to both the card and its arrow for consistency. - Resolves the glitch by adjusting classes exclusively during the enter animation phase, avoiding unintended side effects during leave animation phase. - Adopts a Vue-idiomatic approach for transition management, improving code readability and maintainability. - Improves separation of concerns by isolating animation logic from the component's core functionality, facilitating easier updates or replacements. - Remove unnecessary transitions to enhance code simplicity and performance: - Remove `transition: all` on `.card__expander`, which was identified as the cause of the issue. - Remove unnecessary `transition: all` on `.card`. - Adjust transitions to specifically target and affect the transform property (instead of `all`) to optimize animation behavior and eliminate potential side-effects. These changes not only fix the issue at hand but also contribute to a more maintainable and performant codebase by clarifying animation logic and reducing unnecessary CSS transitions.
- Loading branch information
1 parent
bc7e1fa
commit 5d940b5
Showing
4 changed files
with
52 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/presentation/components/Scripts/View/Cards/CardExpandTransition.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<transition name="card-expand-collapse-transition"> | ||
<slot /> | ||
</transition> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({ | ||
// Empty component for ESLint compatibility, workaround for https://github.com/vuejs/vue-eslint-parser/issues/125. | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
@use "@/presentation/assets/styles/main" as *; | ||
.card-expand-collapse-transition-enter-active { | ||
transition: | ||
opacity 0.3s ease-in-out, | ||
max-height 0.3s ease-in-out; | ||
} | ||
.card-expand-collapse-transition-enter-from { | ||
opacity: 0; // Fade-in | ||
max-height: 0; // Expand | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters