Skip to content

Commit

Permalink
Merge pull request #1079 from dpc-sdp/feature/R20-1834-expandable-con…
Browse files Browse the repository at this point in the history
…tent

[R20-1834] add styles only for initially open sections
  • Loading branch information
dylankelly authored Mar 21, 2024
2 parents c301112 + 226d1d5 commit 2e2c01b
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, ref, onMounted } from 'vue'
import { useComputedSpeed } from '../../composables/useComputedSpeed'
interface Props {
Expand All @@ -11,6 +11,7 @@ const props = withDefaults(defineProps<Props>(), {
})
const containerRef = ref(null)
const startExpanded = ref(false)
const duration = useComputedSpeed(containerRef, '--rpl-motion-speed-9', 420)
function onBeforeEnter(el: any) {
Expand Down Expand Up @@ -47,8 +48,15 @@ function onLeave(el: any, done: Function) {
const classes = computed(() => ({
'rpl-expandable': true,
'rpl-expandable--open': props.expanded
'rpl-expandable--open': props.expanded,
'rpl-expandable--start-expanded': startExpanded.value
}))
onMounted(() => {
if (props.expanded) {
startExpanded.value = true
}
})
</script>

<template>
Expand Down Expand Up @@ -77,7 +85,7 @@ const classes = computed(() => ({
}
}
.rpl-expandable--open {
.rpl-expandable--start-expanded {
height: auto;
overflow: initial;
}
Expand Down

0 comments on commit 2e2c01b

Please sign in to comment.