Add UI animations for expand/collapse actions

This commit improves the user experience by adding smooth transitions
for expanding and collapsing tree node items and documentation sections.
The introduction of these animations makes the interface feel more
dynamic and responsive to user interactions.

Key changes:

- Implement a new `ExpandCollapseTransition` component to wrap UI
  elements requiring expand/collapse animations.
- Utiliz the `ExpandCollapseTransition` in tree view nodes and
  documentation sections to animate visibility changes.
- Refactor CSS to remove obsolete transition mixins, leveraging Vue's
  transition system for consistency and maintainability.
This commit is contained in:
undergroundwires
2024-02-18 22:38:32 +01:00
parent faa7a38a7d
commit fb08f03765
7 changed files with 417 additions and 57 deletions

View File

@@ -27,7 +27,7 @@
</LeafTreeNode>
</div>
</InteractableNode>
<transition name="children-transition">
<ExpandCollapseTransition>
<ul
v-if="hasChildren && isExpanded"
class="children"
@@ -44,12 +44,13 @@
</template>
</HierarchicalTreeNode>
</ul>
</transition>
</ExpandCollapseTransition>
</div>
</template>
<script lang="ts">
import { defineComponent, computed, toRef } from 'vue';
import ExpandCollapseTransition from '@/presentation/components/Shared/ExpandCollapse/ExpandCollapseTransition.vue';
import { TreeRoot } from '../TreeRoot/TreeRoot';
import { useCurrentTreeNodes } from '../UseCurrentTreeNodes';
import { NodeRenderingStrategy } from '../Rendering/Scheduling/NodeRenderingStrategy';
@@ -64,6 +65,7 @@ export default defineComponent({
components: {
LeafTreeNode,
InteractableNode,
ExpandCollapseTransition,
},
props: {
nodeId: {
@@ -178,19 +180,4 @@ export default defineComponent({
}
}
}
@mixin left-fade-transition($name) {
.#{$name}-enter-active,
.#{$name}-leave-active {
transition: opacity .3s, transform .3s;
transform: translateX(0);
}
.#{$name}-enter-from,
.#{$name}-leave-to {
opacity: 0;
transform: translateX(-2em);
}
}
@include left-fade-transition('children-transition');
</style>