Skip to content

Commit

Permalink
feat: Add transition effect for reordering questions
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Feb 28, 2023
1 parent 86f357a commit ff5e6fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/components/Questions/Question.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export default {
margin-bottom: 80px;
padding-left: 44px;
user-select: none;
transition: var(--animation-slow);
background-color: var(--color-main-background);
> * {
Expand Down
32 changes: 19 additions & 13 deletions src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,21 @@
@change="onQuestionOrderChange"
@start="isDragging = true"
@end="isDragging = false">
<Questions :is="answerTypes[question.type].component"
v-for="(question, index) in form.questions"
ref="questions"
:key="question.id"
:can-move-down="index < (form.questions.length - 1)"
:can-move-up="index > 0"
:answer-type="answerTypes[question.type]"
:index="index + 1"
:max-string-lengths="maxStringLengths"
v-bind.sync="form.questions[index]"
@delete="deleteQuestion(question)"
@move-down="onMoveDown(index)"
@move-up="onMoveUp(index)" />
<transition-group :move-class="isDragging ? 'nomove' : undefined">
<Questions :is="answerTypes[question.type].component"
v-for="(question, index) in form.questions"
ref="questions"
:key="question.id"
:can-move-down="index < (form.questions.length - 1)"
:can-move-up="index > 0"
:answer-type="answerTypes[question.type]"
:index="index + 1"
:max-string-lengths="maxStringLengths"
v-bind.sync="form.questions[index]"
@delete="deleteQuestion(question)"
@move-down="onMoveDown(index)"
@move-up="onMoveUp(index)" />
</transition-group>
</Draggable>
<!-- Add new questions menu -->
Expand Down Expand Up @@ -444,6 +446,10 @@ export default {
</script>
<style lang="scss" scoped>
.nomove {
transition: none!important;
}
.app-content {
display: flex;
align-items: center;
Expand Down

0 comments on commit ff5e6fa

Please sign in to comment.